https://bugs.linaro.org/show_bug.cgi?id=3690
Bug ID: 3690 Summary: fdserver process interferes with signal handling Product: OpenDataPlane - linux- generic reference Version: master Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: --- Component: Shared Memory Assignee: christophe.mil...@linaro.org Reporter: janne.pelto...@nokia.com CC: lng-odp@lists.linaro.org Target Milestone: --- The SHM implementation forks a child process that will stay in the same process group as the parent and will thus receive the signals sent to the group. One situation where this happens is when an ODP application is run in a shell and ctrl-C is pressed. An application may set a signal handler to handle ctrl-C presses in some controlled way, but now there are two problems caused by the fdserver: 1) The signal handler set by the application runs also in the context of the fdserver process. The handler may misbehave because the environment in the fdserver process can be different than in the application controlled processes. 2) Even if the signal handler runs correctly in the fdserver process context, the main loop of fdserver is not prepared to have its accept() call interrupted by a signal, causing fdserver to exit. I bumped into this when wondering about annoying error messages that I got when stopping the fpm example application of OFP. Problem 1) caused the signal handler to segfault and if that is fixed in fpm (by doing less in the handler) then problem 2) would still cause the same error messages. I am not sure what the right fix would be. Maybe fdserver should do setsid() to detach itself from the parent's process group, or maybe not because then it could not output its error messages to the terminal anymore. Or maybe it should just mask a bunch a signals. I think fdserver should at least handle EINTR errors so that an application like fpm can try to handle the rest. This would suffice (some indentation fixes included): diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index 065736f0..af9ca4a0 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -559,8 +559,11 @@ static void wait_requests(int sock) addr_sz = sizeof(remote); c_socket = accept(sock, (struct sockaddr *)&remote, &addr_sz); if (c_socket == -1) { - ODP_ERR("wait_requests: %s\n", strerror(errno)); - return; + if (errno == EINTR) + continue; + + ODP_ERR("wait_requests: %s\n", strerror(errno)); + return; } -- You are receiving this mail because: You are on the CC list for the bug.