Hi Norman,
in order to simplify the implementation of multi-threaded/multi-entrypoint servers, I made an attempt to extract the generic part from the multi-threaded timer implementation you referenced.
I therefore created a Root_component_multi and a Session_component_multi from which a server implementation can easily inherit. As far as I know, it is working in Mohammad's case.
I put this on github so that anyone else can reuse the code [1].
[1] https://github.com/ValiValpas/genode/commit/b8afa38dc98a28da525442022f7a0149...
Best Johannes
On Wed, 02 Jul 2014 14:37:04 +0200 Norman Feske <norman.feske@...1...> wrote:
Hi Mohammad,
from the client side i connect to the both server by telent each of them and type message to them and it work smoothly. so , I think without using the RPC we dont have the blocking problem or may be my test was wrong . i will attach the .run ,server.c and .mk files .
your test is exactly what I had in mind for simplifying the scenario. Since the test works when two threads are using lwIP directly, we know that your issue is not related to the way lwIP works. Your test pinpoints the problem to the RPC interface. It seems that you have missed a step when turning the RPC interface multi-threaded. Please make sure that
Your 'Lwip::Session_component' has an 'Rpc_entrypoint' as a member variable. So each time, a session is created, a dedicated entrypoint get created, too.
Your 'Lwip::Session_component' is managed by the session's own entrypoint, not the entrpoint that serves the root interface. Note that the default 'Root_component' provided by Genode's 'root/component.h' does not what you want. You cannot use the
default implementation but implement the 'Root_component' yourself. Please take a close look at the timer variant [1] I referenced in my email from May 28.
[1] https://github.com/genodelabs/genode/tree/b54bdea2aae245b2d8f53794c1c1b9b2da...
To see that each lwIP session is executed by a different thread, you may add the following debug output to one of the lwIP RPC functions (e.g., at the beginning of 'accept').
PDBG("thread_base at %p", Genode::Thread_base::myself());
The 'myself' function returns a different pointer for each thread that calls the function. You will see two messages, one for each session. If you see two different pointer values, you know that both sessions are dispatched by different threads - this is what we want. I guess that you will see the same value twice.
If the problem persists, would you consider to make branch publicly available (e.g., on GitHub) so that I could have a look?
On another note, have you had success with inspecting the scenario using GDB on Linux?
Good luck! Norman