-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARM Unittest Failures #14
Comments
First of all: thank you for your work try porting libcppa to ARM! What system are you using? What compiler version? Yielding is an essential component of the cooperative actor scheduling. If this doesn't work, the scheduler doesn't work. That's why test spawn is stuck in a deadlock. Either the ucontext API doesn't work as expected or the yield interface doesn't work. The yield interface uses "__thread" variables of GCC, see src/yield_interface.cpp. Is this feature available on ARM? Good luck! |
System is a Tegra 2 (in a Trim Slice - http://trimslice.com/) running Arch Linux ARM with GCC 4.6.2. Kernel is 2.6.38.3 (I can't upgrade to 3.1 due to some hardware support issues). I recall reading at some point that the ucontext API is deprecated? I'll look into it. I'll take a closer look. |
It looks like the ucontext API has been removed from the POSIX standard, but I don't know whether that's considered deprecation or not. |
As far as I can tell, because ucontext has been removed from the POSIX standard, it will remain on platforms where it's already implemented but will not be ported to new platforms. Apparently ARM falls into the latter category. There are supposed to be linker warnings that getcontext/setcontext will always fail, but I don't see them for some reason (even when building 5 line ucontext demo applications). |
Well, the default actor implementation needs an own stack. Thus, setjmp/longjmp doesn't help much. What about GNU pth? It should be relatively easy to port libcppa from ucontext to GNU pth if it does work on ARM. |
I just wrote a sample program, and pth does seem to be working. Given that the current attitude in glibc is that ucontext is deprecated and should be avoided, pth does look like a good alternative. |
I just read the GNU pth documentation for porting libcppa to it, but it's not possible since GNU pth implements its own single-threaded scheduling. Sorry! I thought pth provides primitives for context switching but its a different approach to ucontext. I will search for an alternative. I'm really sorry for wasting your time. :/ Btw, Microsoft implemented its own user-space threading library called fibers: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx |
Alright, well, I don't know of any alternatives, but I'll poke around and see if I can find anything. I see what you mean about scheduling, though. |
I have yet to try it out, but this looks like it implements the abstraction you're looking for: http://www.xmailserver.org/libpcl.html EDIT: Just tried it, and fortified glibc doesn't like it on ARM. I'll see what I can do... |
Things like libpcl, libtask, etc. are too high level. All libcppa needs is swapcontext() functionality. In particular, libcppa needs a library without internal state. Thus, everything providing init() or something similar is out. extern int pth_uctx_create(pth_uctx_t *);
extern int pth_uctx_make(pth_uctx_t, char *, size_t, const sigset_t *, void (*)(void *), void *, pth_uctx_t);
extern int pth_uctx_switch(pth_uctx_t, pth_uctx_t);
extern int pth_uctx_destroy(pth_uctx_t); I will try to port libcppa to pth using only the context switching functionality of it. I guess it should be straight forward and should run on ARM since you already tested it successfully. :) |
I've ported libcppa to pth and poked a bit around with it. In short: it doesn't work. The unit test of the yield interface is successful, but as soon as you try to spawn an actor, your application is dead. However, libcppa is LGPL software. Feel free to fork it and try porting it yourself (if you have the time to do so). fiber.cpp is the only file you'll need to modify. |
Thanks for looking into this, and sorry it didn't wind up working. |
You can disable context switching now by using ./configure CXXFLAGS="-DCPPA_DISABLE_CONTEXT_SWITCHING". Be aware that this will cause each actor to run in its own thread unless you're using event-based actors. Btw, you always should use event-based actors anyways, since they run faster and scale better. However, a subset of libcppa is better than nothing, isn't it? |
The last test hangs indefinitely. I'm not sure how to proceed with testing this, any thoughts?
The text was updated successfully, but these errors were encountered: