Hi there, have noticed an issue when trying to relocate larger events using a custom plugin via locext. It seems that when the size of the event info XML being piped gets too large (64kb? around 200 phase picks) the child process trips the parent and scolv permanently hangs despite the locator working as expected.
Here is a machine synopsis if helpful, usual boulder of salt advised:
plugins/locator/external/external.cpp
L258 waitpid() precedes the L271 read loop — deadlock. The parent will not read outPipe until the child has exited, so a child whose stdout exceeds the 64 KiB pipe capacity blocks in write() while the parent blocks in waitpid(). Neither can proceed.
L249 write(inPipe[1], content.c_str(), content.size()) — return value discarded. Two problems in one call. A blocking write interrupted by a signal after a partial transfer returns the short count rather than resuming, and scolv is a Qt process with timers and SIGCHLD in flight, so the child silently receives a truncated document. And because the write is not interleaved with reading outPipe, a child that emits output before consuming all its input deadlocks symmetrically — the parent never reaches waitpid() in that case, so it presents differently from the first defect.
L258 waitpid() has no EINTR retry and the flags are wrong. res <= 0 throws "system error: exec", so a waitpid() interrupted by any signal fails a location that was about to succeed, and leaves a zombie. WUNTRACED | WCONTINUED compounds it: if the child is ever stopped or continued, waitpid() returns with WIFSTOPPED/WIFCONTINUED, the WIFEXITED test at L265 fails, and the parent throws "external script exited with error" while the child is still alive and unreaped. Those flags serve no purpose here and should simply be 0. The L271 read() loop likewise treats EINTR as end-of-stream.
L166–204, the child branch, leaks scolv's file descriptors across execvp. Only fd 0 and 1 are handled; the messaging socket, the database connection, and the X11 connection are all inherited by the locator script and held for its lifetime.
Hi there, have noticed an issue when trying to relocate larger events using a custom plugin via
locext. It seems that when the size of the event info XML being piped gets too large (64kb? around 200 phase picks) the child process trips the parent andscolvpermanently hangs despite the locator working as expected.Here is a machine synopsis if helpful, usual boulder of salt advised:
plugins/locator/external/external.cppL258
waitpid()precedes the L271 read loop — deadlock. The parent will not read outPipe until the child has exited, so a child whose stdout exceeds the 64 KiB pipe capacity blocks in write() while the parent blocks in waitpid(). Neither can proceed.L249
write(inPipe[1], content.c_str(), content.size())— return value discarded. Two problems in one call. A blocking write interrupted by a signal after a partial transfer returns the short count rather than resuming, and scolv is a Qt process with timers and SIGCHLD in flight, so the child silently receives a truncated document. And because the write is not interleaved with reading outPipe, a child that emits output before consuming all its input deadlocks symmetrically — the parent never reaches waitpid() in that case, so it presents differently from the first defect.L258
waitpid()has no EINTR retry and the flags are wrong. res <= 0 throws "system error: exec", so a waitpid() interrupted by any signal fails a location that was about to succeed, and leaves a zombie. WUNTRACED | WCONTINUED compounds it: if the child is ever stopped or continued, waitpid() returns with WIFSTOPPED/WIFCONTINUED, the WIFEXITED test at L265 fails, and the parent throws "external script exited with error" while the child is still alive and unreaped. Those flags serve no purpose here and should simply be 0. The L271 read() loop likewise treats EINTR as end-of-stream.L166–204, the child branch, leaks scolv's file descriptors across execvp. Only fd 0 and 1 are handled; the messaging socket, the database connection, and the X11 connection are all inherited by the locator script and held for its lifetime.