Hi. I've discovered a mysterious bug in my callback library during the stress-testing. Probably, it is a multithreading issue. In summary, the library starts several callback threads during initialization, each thread creates the `uw_context', opens database connection and waits for incoming callback requests. The rest of the library executes the server-side tasks and sends results (stdout, exit code, etc) to the threads. All the problems below are demonstrated by the Demo.exe application (demo/ folder of the project sources).
The facts are: - When I run my application with only one callback thread, everything works fine - Increasing the number of callback threads up to 10 results in 95% chance of Segfault during init, but only if no debugger attached. Executing the Demo.exe via GDB doesn't show any crashes. - Increasing the number of main urweb threads (-t N argument) doesn't affect the situation - Sometimes the Demo.exe starts successfully (~ 5% chance with 10 callback threads). In this case feeding it with tasks results in random 'Serialization failure's reported from the callback threads. Since gdb can't help me, I feel I'm in trouble. Could you please review the code and point me to the potential pitfalls? System-specific things seem to work, the problem is likely in the urweb-specific part of the library. Do I call uw_init correctly? Is it OK to call uw_begin_init like I do? The thread code is in the `devel' branch of the urweb-callback repo, CallbackFFI.cpp, struct notifiers (line 377) https://github.com/grwlf/urweb-callback/blob/devel/CallbackFFI.cpp#L377 Thanks in advance, Sergey _______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
