Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 06:41

    josephnoir on master

    Simply functor_attachable imple… Allow non-const default handlers Add compile-time checks for rec… and 1 more (compare)

  • 06:41

    josephnoir on neverlord

    (compare)

  • 06:41
    josephnoir closed #1272
  • 05:50
  • Jun 20 06:29
    Neverlord labeled #1277
  • Jun 20 06:29
    Neverlord labeled #1277
  • Jun 20 06:28
    Neverlord commented #1277
  • Jun 20 06:28
    Neverlord closed #1277
  • Jun 20 06:28

    Neverlord on master

    Add crate-ci/typos workflow Rename config file name for typ… Merge pull request #1277 (compare)

  • Jun 19 21:07
  • Jun 19 19:29
    Neverlord review_requested #1272
  • Jun 19 19:27

    Neverlord on 1277

    Add crate-ci/typos workflow Rename config file name for typ… (compare)

  • Jun 19 19:23
    Neverlord synchronize #1272
  • Jun 19 19:23

    Neverlord on neverlord

    Add compile-time checks for rec… (compare)

  • Jun 18 18:59
    Hamdor commented #1277
  • Jun 18 18:57
    Hamdor synchronize #1277
  • Jun 18 18:51
    Hamdor opened #1277
  • Jun 18 18:18
    Neverlord commented #1272
  • Jun 18 18:17
    Neverlord synchronize #1272
  • Jun 18 18:17

    Neverlord on neverlord

    Simply functor_attachable imple… Allow non-const default handlers Add compile-time checks for rec… (compare)

hoskylucky
@hoskylucky
Something like : static_assert(
(has_type_id_v<Ts> && ...),
"inspectors requires that each type in a variant has a type_id"); -- error C2059
Dominik Charousset
@Neverlord
Where did you have the compiler errors? When compiling CAF itself?
The assertion triggers when a custom type does wasn't listed in a type ID block like this: https://github.com/actor-framework/actor-framework/blob/master/examples/custom_type/custom_types_1.cpp#L15
hoskylucky
@hoskylucky
just compile the CAF
Dominik Charousset
@Neverlord
Ok, then the MSVC version might indeed be too old. We generally only support most recent versions. Our last CI build says Visual Studio 16 2019.
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
-- The CXX compiler identification is MSVC 19.28.29335.0
hoskylucky
@hoskylucky
ok,thank you, I want know that is there using a new grammar
Dominik Charousset
@Neverlord
grammar?
hoskylucky
@hoskylucky
like "static_assert(
(has_type_id_v<Ts> && ...),
"inspectors requires that each type in a variant has a type_id");"
Dominik Charousset
@Neverlord
Yeah, C2059 indicates that your version of MSVC does not recognize the new syntax: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2059?view=msvc-160
hoskylucky
@hoskylucky
ok, I think the vs2017 only support some of c++17 syntax, i have to use vs2019 for now, thank you again.
Dominik Charousset
@Neverlord
Glad I could help. :)
Adrian Jutrowski
@Tarjei400
Hello! Did any of you use gtest for testing caf apps?
Dominik Charousset
@Neverlord
There's nothing wrong with gtest, but we recommend using the CAF testing DSL instead. It lets you test your actors in a fully deterministic environment on a by-message basis.
Adrian Jutrowski
@Tarjei400
Yes I see its really neat. I just noticed it creates single executable per test file if I am not mistaken? Its kinda annoying in visual studio which for now my team is stuck with :/
Dominik Charousset
@Neverlord
The main.cpp is always the same, so you could generate multiple CMake-targets that each compile a single test suite into one binary.
Adrian Jutrowski
@Tarjei400
Thats the problem we dont use cmake yet :D Thanks anyway!
Dominik Charousset
@Neverlord
:D
Dominik Charousset
@Neverlord
multithreading.png
😂
Dominik Charousset
@Neverlord
tease.png
🤔
Farafonov Alexey
@farafonov-alexey

Hello guys. I'm building caf for Android and got this kind of error.

/home/alexey/.conan/data/caf/0.17.4/mypos.restart+fiscal-core/stable/build/bf600042e8b36bba73e1be4b180544c3b48c09a1/source_subfolder/libcaf_io/src/io/network/default_multiplexer.cpp:803:13: error: no matching function for call to 'getsockname'
            getsockname(fd, reinterpret_cast<sockaddr*>(&sa), &len));
            ^~~~~~~~~~~
/home/alexey/.conan/data/caf/0.17.4/mypos.restart+fiscal-core/stable/build/bf600042e8b36bba73e1be4b180544c3b48c09a1/source_subfolder/libcaf_io/caf/detail/call_cfun.hpp:53:14: note: expanded from macro 'CALL_CFUN'
  auto var = expr;                                                             \
             ^~~~
/opt/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/socket.h:310:18: note: candidate function not viable: no known conversion from 'caf::io::network::socket_size_type *' (aka 'unsigned int *') to 'socklen_t *' (aka 'int *') for 3rd argument
__socketcall int getsockname(int __fd, struct sockaddr* __addr, socklen_t* __addr_length);

Can I overcome this somehow?

Try change using socket_size_type = unsigned; to ... = int; for Android.
But you may want to avoid functions like publish and remote_actor on Android anyway. Giving devices that aren't under your control full access to remote CAF nodes via CAF's internal protocol raises several security concerns.
Just mentioning it. If you're using the I/O module for broker and custom protocols it's fine.
Farafonov Alexey
@farafonov-alexey
@Neverlord thank you!
Bashuman
@bashuman_twitter
Has anybody built utilities atop caf for timers ? In a nutshell, things that could be created and cancelled easily in the scope of the behavior ? Any gems of wisdom to share ?
Dominik Charousset
@Neverlord
Currently there's no convenience API, you probably mean something on top of scheduled_send or delayed_send? What kind of API would you been looking for?
Bashuman
@bashuman_twitter
I was looking at things like:
auto timer_handle = create_timer(duration, target, args....);

timer_handle.cancel()
Dominik Charousset
@Neverlord
And target is just some function/lambda?
Bashuman
@bashuman_twitter
I would think that target would be another actor
or self
it could be a closure with an actor too, thinking of it
Actually making a lambda would make for an easier programming task as I think through it
Dominik Charousset
@Neverlord
Hm, I had the idea of a run_delayed feature a while back: https://github.com/actor-framework/actor-framework/issues/584#issuecomment-608627958. If that function would return a disposable/cancellable, would that be what you're looking for?
Dominik Charousset
@Neverlord
If that'd fit the bill feel free to file a feature request. No promises, but a small feature like this could still make it to 0.19. :)
Bashuman
@bashuman_twitter
Will do :) My feature request was much simpler as I think about it. If delayed_send returned a cancellable it would probably suffice
Dominik Charousset
@Neverlord
👍
Tyler St. Onge
@tylerstonge
what is the recommended way to handle a broker attempting a reconnection on failure? I tried having it emit a delayed message to a supervisor on error. The supervisor attempts to use spawn_client, but keeps failing with an error code 17. It it's the direct time the connection is attempted it will pass though.
Dominik Charousset
@Neverlord

17 is cannot_connect_to_node: https://github.com/actor-framework/actor-framework/blob/master/libcaf_core/caf/sec.hpp#L61. If you call to_string on the error, it should also print additional information.

In general, instead of doing error signaling manually, I'd recommend just terminating the broker with an error and monitor it from the supervisor. Whenever it sees the broker go down, you can start some reconnect logic (e.g. try reconnect every X seconds up to Y times).

Bashuman
@bashuman_twitter
Lazy design question around file io. So a bunch of actors want to append to a log file. These actors are also doing work, so would like to avoid blocking work as much as possible. Any established design paradigms out there ?
Dominik Charousset
@Neverlord
Are you doing the file I/O per actor or do you have one actor dedicated to file I/O? In the latter case, I'd recommend detaching this actor since it's probably blocked on some file handle most of the time. If you have a large volume of log events, you may also want to add some token-based mechanism to make sure the other actors slow down if the file I/O can't keep up.
Also sounds like a good use case for the new flow API, so when it lands that could make your life a bit easier.
Kirill Alpin
@liquidnode
Hi there. I would like to use CAF for a distributed application consisting of server nodes which hold different actors. Clients can connect to the server cluster via their own client actor. I did some tests and this kind of architecture seems to be possible to implement in CAF.
There are two problems though, both related to security and the fact that one is not able to trust clients. First, it is important, that client actors are only allowed to send messages to specific actors on the server cluster, so clients can not mess with server operation. Then, it should not be possible for the client to spawn a server internal actor.
I guess both problems have to be handled in the middleman on the server, where messages can be filtered based on the location of the sender (all server actors are in the same network). My question is if these security measures are already possible in CAF and if not, how difficult would it be to implement them?
Dominik Charousset
@Neverlord
When talking to untrusted clients, I wouldn't connect them at the CAF level and use a different protocol instead. We have started caf_net in the incubator to help with this kind of scenario. So far there is an implementation for WebSocket available (examples see here: https://github.com/actor-framework/incubator/tree/master/examples/net) and some utilities for interfacing actors with network protocols (actor shell).
These APIs are still rather low-level at the moment, but that's the route I would go down.