Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
doncoolhoney
@doncoolhoney_twitter
My hello program code doesnt work anyone caould please help??
unction "mirror" returns incomplete type "caf::behavior" and alot of other errors..
can anyone pleaase guide to run hello worlld program steps..... i have compiled camke completely...
Dominik Charousset
@Neverlord
I think that's out of scope for a chat like this. But I'm sure you can find good CMake tutorials online. Incomplete type usually means you didn't include the proper headers or your include paths aren't correct.
Cem Degirmenci
@sputnikcem_twitter
Hi I have created an example to study the difference between request.then and request.await. I have a scoped actor which sends 5 messages to a master actor and this master actor in its behavior sends a message to a slave actor which returns the sum of 2 integer and sleeps for 1 seconds.
It is as expected i.e. if I use then I see that masters behaviors are activated without waiting for slave answers
the question is when I use <message_priority::high> await does not function after the first call
is this expected?
image.png
image.png
Cem Degirmenci
@sputnikcem_twitter
image.png
Cem Degirmenci
@sputnikcem_twitter
ah I see, if the master also sends the message with high priority the problem is solved
Cem Degirmenci
@sputnikcem_twitter
can one use OpenMP with the Actor framework? I can compile and run the code but can only get a single omp thread running
Dominik Charousset
@Neverlord
Regarding the high-prio: you shouldn't need to forward it with hight priority. Mind making a minimal example and open a GitHub issue?
OpenMP: be careful when combining CAF with any other framework that spins up a thread pool on its own. If both are busy, you pay for a lot of context switches by overbooking the CPU.
Cem Degirmenci
@sputnikcem_twitter
for the OpenMP question -fopenmp should be added to both compile and link flags in the CMakefile if anyone wants to use it
doncoolhoney
@doncoolhoney_twitter

Anyone have a short but good example of middleman in CAF..Please share.. because I am facing issues in publishing....

invalid use of incomplete type ‘class caf::io::middleman’

Any small example please!..

Dominik Charousset
@Neverlord
Incomplete type usually means you're only having a forward declaration, i.e., you're missing the include. An example for publish/remote_actor is here: https://github.com/actor-framework/actor-framework/blob/master/examples/remoting/distributed_calculator.cpp.
Cem Degirmenci
@sputnikcem_twitter
hi the system has a registry() function to reach the actor_registry, but where is the proxy_registry instance? I checked middleman.hpp as well under io but could not find it so far
Dominik Charousset
@Neverlord
The proxy registry isn't accessible from outside the BASP broker. It's only an implementation detail for holding the state required to represent remote actor.
Cem Degirmenci
@sputnikcem_twitter
ok then I need to keep my own data structure
kapilpipaliya
@kapilpipaliya
how to stream video data from one actor to many actors?
Dominik Charousset
@Neverlord
There's currently no readily-available binding to gRPC or other messaging libraries.
Nannnnnn
@Nannnnnn

Hi everyone, I got a problem when I try to use request method like this, do you know why? Thanks!

void my_send(event_based_actor src, actor dst, char* message)
{
src->request(dst, std::chrono::seconds(10), message);

}

Dominik Charousset
@Neverlord
That's not how you use request. :)
You're not telling it what to do with the response and you can't take an event-based actor as value. Have a look at the example: https://github.com/actor-framework/actor-framework/blob/master/examples/message_passing/request.cpp.
Nannnnnn
@Nannnnnn
@Neverlord Thanks for your comment! Is there any workaround for sending a message by indicating the sender like send_msg(sender, receiver, ...) or any other type of actor can achieve that? a typed actor?
Dominik Charousset
@Neverlord
Can you explain a bit more what you're trying to do? Statically typed actors only allow the compiler to run type-checks on your message. Sender information is always encoded in messages regardless.
Nannnnnn
@Nannnnnn
I am trying to create a new message sending API that can send message as long as it knows the sender's pointer and receiver's pointer. It is sth. like: send_msg(sender pointer, receiver pointer, message body, ...)
Dominik Charousset
@Neverlord
Then that's just sender->send(receiver, ...), isn't it? Generally speaking, though, CAF does not hand out pointers because actors are supposed to share no state. You handles instead. Maybe this here helps you grok how CAF is structured: https://www.cafcademy.com/articles/implementing-actors-part-1

@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?

Dominik Charousset
@Neverlord
I'll take a look when I got some time on my hands (i.e., not right now). :)
Dominik Charousset
@Neverlord
Are you running a scoped actor inside an event-based actor?
Farafonov Alexey
@farafonov-alexey

Are you running a scoped actor inside an event-based actor?

No, we have some regular class which do this in order to communicate with actor-world.

Dominik Charousset
@Neverlord
Hm. If you can reproduce some kind of hanging even with just calling the constructor of 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.
Cem Degirmenci
@sputnikcem_twitter
is it possible to use a scoped_actor to request the proxy of a remote actor as in distributed_calculator.cpp?
in distributed_calculator.cpp a stateful actor is used for this purpose
I get something like invalid use of 'void'
image.png
Dominik Charousset
@Neverlord
Whether you're using a scoped actor doesn't matter for the MM actor. What's the error?
Cem Degirmenci
@sputnikcem_twitter
image.png
I don't know where the void comes from actually
Dominik Charousset
@Neverlord
It's generally more helpful to paste the error into chat using markdown blocks. :)
Hard to tell without the full context what's wrong here. The self->request(...).receive(...) part LGTM tho: https://github.com/actor-framework/actor-framework/blob/master/examples/message_passing/request.cpp#L65.
Cem Degirmenci
@sputnikcem_twitter
I will test with this function thank you
Cem Degirmenci
@sputnikcem_twitter
I get : error: static assertion failed: receiver does not accept given message if I try to use this code block
Dominik Charousset
@Neverlord
The middleman actor does not accept a get message. The code was meant as an example on how scoped actors use request().receiveI(), I didn't want you to just paste that code into your source file.
Cem Degirmenci
@sputnikcem_twitter
ok casting port to uint16_t was necessary
thank you :D
Dominik Charousset
@Neverlord
Complaining about void was a bit misleading, then... Oh well, that's C++ compiler errors for you. Glad you figured it out. :)
Cem Degirmenci
@sputnikcem_twitter
I have one more question, if I receive pointer of a typed_actor from the middleman, which has std::set<std::string>& ifs non empty, how should I use the actor cast?
I mean I get a strong_actor_ptr but how can I cast it to a typed actor for sending a message?