Neverlord on neverlord
Silence deprecation warning (c… (compare)
Neverlord on neverlord
Implement process_open_fds metr… (compare)
Neverlord on neverlord
Implement process_open_fds metr… (compare)
Neverlord on neverlord
Implement process_open_fds metr… (compare)
Neverlord on neverlord
Merge branch 'topic/neverlord/m… (compare)
Neverlord on neverlord
Merge branch 'topic/neverlord/m… (compare)
Neverlord on neverlord
Fix instance getters on the met… (compare)
Neverlord on neverlord
Set reuse-addr for Prometheus p… (compare)
@Neverlord Hello Dominik. We experiencing some strange caf behavior. Our CAF version is 0.17.4. We have library that has event_based_actors. Library has some method with return values, so is blocking by nature. To work with this actors we use this pseudo code
caf::scoped_actor self{system_};
int result = -1;
self
->request()
.receive(
[&](...) {
...
},
[&](caf::error& err) {
...;
});
return result;
With this code we experiencing timeout before our application with loaded library exits about 30 seconds.
We can reproduce that still one line:
caf::scoped_actor self{system_};
can produce that behavior.
Two log file with and without that line are above.
Can you share your thoughts on this. What maybe the cause?
scoped_actor
, then I don't see what might cause this in CAF itself. The constructor has no blocking code in it: https://github.com/actor-framework/actor-framework/blob/master/libcaf_core/src/scoped_actor.cpp#L41. Unless it has something to do with other factors in your application, the only thing that might block is the logger if it gets overwhelmed with log messages because it's using a fixed-size buffer (precisely to slow down an application if logs too fast for the logger to keep up). But for you to wait several seconds in this call, you would have produce tons and tons of log messages in another thread.
self->request(...).receive(...)
part LGTM tho: https://github.com/actor-framework/actor-framework/blob/master/examples/message_passing/request.cpp#L65.
You can use the run-time-type information to check whether a cast to your target type is safe. Basically:
system. message_types<Handle>()
gives you the expected set: https://github.com/actor-framework/actor-framework/blob/master/libcaf_core/caf/actor_system.hpp#L250.
Then you can ask whether you can assign something you've received to the what you're expecting: https://github.com/actor-framework/actor-framework/blob/master/libcaf_core/caf/actor_system.hpp#L261.
Hello, I am trying to get acquainted with the actor model using CAF and I have a few questions in mind (not related to each others):
Thank you for your time
Fibers are usually used to build co-routine like abstractions. It's just at a lower abstraction level than actors. You can just spawn actors and assign tasks to them, but you won't have much control over what runs when. If all you need is a bunch of workers doing things in the background that's fine. If you're designing a game engine and need very tight control over the scheduling than you probably need a different solution like the one naughty dog was building.
LMAX disruptors: you neder know until you try and benchmark. :)
I don't have a particular article or talk I could recommend for the actor model in general, but at least for CAF there are some articles available online that should be better suited for learning aspects of the framework than manual/docs: https://www.cafcademy.com/articles.
Thank you @Neverlord
You can just spawn actors and assign tasks to them, but you won't have much control over what runs when
Does CAF provides an API for defining priorities in its scheduler? I know that the actor model is supposed to be asynchronous but as there is an experimental streaming API in CAF is it possible to have some control over a pipeline latency similar to what GStreamer provides?
If you're designing a game engine and need very tight control over the scheduling than you probably need a different solution like the one naughty dog was building.
I saw that Novaquark is using CAF for their game engine. I would be very curious to know how they use it, but I bet they won't disclose it anytime soon ;)
I know... just so many questions (please excuse me)
Does CAF provides an API for defining priorities in its scheduler?
No. Also, if you're starting new code I wouldn't recommend the current streaming API since we're currently working on a complete redesign that's going to look a. lot more like ReactiveX-style APIs (https://twitter.com/actor_framework/status/1390192103200759810). But even there, the model is asynchronous and "runs eventually". If you have actors that should stay responsive at all times, you can detach them, i.e., give them their own thread of execution.
I saw that Novaquark is using CAF for their game engine. I would be very curious to know how they use it
Yeah, they probably won't exactly share their sources.. :)
Hi, i'm installing CAF on Ubuntu 20.10. When I try to run the configure file, then the following error occurs:
-- The CXX compiler identification is GNU 10.2.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/CMakeLists.txt:373 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"/home/student/Desktop/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/libcaf_core"
is not a subdirectory of
"/home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
CMake Error at /home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/CMakeLists.txt:376 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"/home/student/Desktop/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/libcaf_io"
is not a subdirectory of
"/home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
CMake Error at /home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/CMakeLists.txt:380 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"/home/student/Desktop/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/libcaf_openssl"
is not a subdirectory of
"/home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
CMake Error at /home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/CMakeLists.txt:384 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"/home/student/Desktop/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/examples"
is not a subdirectory of
"/home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
CMake Error at /home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/CMakeLists.txt:388 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory
"/home/student/Desktop/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master/tools"
is not a subdirectory of
"/home/student/Desktop/student/Desktop/student/Desktop/student/Downloads/actor-framework-master".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
-- Configuring incomplete, errors occurred!
See also "/home/student/Desktop/student/Downloads/actor-framework-master/build/CMakeFiles/CMakeOutput.log".
The path of caf source code is; /home/student/Desktop/student/Downloads/actor-framework-master. Is something missing in my configuration? Thank you in advance!
exit_reason
?
category() == type_id_v<exit_reason>
.
Isn't this code supposed to check whether the error is an
exit_reason
?
Yes. Thank you!
[build] ...MSVC\14.28.29333\include\xmemory(701,82): error C2440: 'initializing': cannot convert from 'const caf::byte' to '_Objty'
[build] with
[build] [
[build] _Objty=unsigned char
[build] ]
Can you share what steps you've taken? Git checkout, configure arguments, etc. The CMake output looks weird, like something messed with the folders.
Hi Dominik, i just downloaded the source code from git, and ran ./configure without arguments (like the document on git).