-
Notifications
You must be signed in to change notification settings - Fork 102
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
Hang inside _IO_proc_close() during destruction. #10
Comments
Forgot to mention the platform is Linux on Gentoo. |
I replied to the github email a while back, but I'm not sure whether that went anywhere, since it didn't appear on this page. I'm running Linux too (Ubuntu), so that's the most tested platform. I have no idea what could cause the hang. The pclose function will hang until the gnuplot process exits, which should normally happen right away. Are you using fork? That might do something odd to the file descriptors. Threads should be okay, I think, as long as you don't have two threads messing with the same Gnuplot object. As for running out of file descriptors... I would hope that would not be a problem as long as they are being closed. But I don't know that much about it. I've never used it in a mode where the Gnuplot objects are rapidly created and destroyed. I am interested in finding out what's going on here, but if you need a workaround you might try just creating a single Gnuplot object and re-using that. The included example program example-misc.cc contains an animation example that rapidly re-plots new data with a single gnuplot invocation. Can you send me a minimal example program that reproduces the problem? |
Sorry for the delay, thought I fixed it but ended up reproducing it. I have determined that gnuplot is hung as well when this happens, might be their issue, not sure. I noticed when this happens, I have a spare gnuplot process running with the -persist argument. I attached gdb to it and got a stack trace (no debug symbols for now, but it's in syscalls anyways). I cannot get a test program together at the moment, codebase on our side is massive. I'll try to see if I can get something but it's doubtful. Only thing I noticed is gnuplot is inside of a signal handler and blocked on a write. Our side has already entered the destructor so perhaps our side is destroying the pipe too quickly via a race?
|
At first I thought the signal might be SIGPIPE, sent when the writer (the gnuplot-iostream library) calls pclose. However, the pipe(7) man page says that SIGPIPE is only sent to the writer. The reader (gnuplot) should just get EOF. So I have no idea what that signal is or why gnuplot would hang on writing the png, unless the filesystem is blocking (e.g. if it is flushing the write cache after tons of writes). It's really bizarre that the stack trace goes png_write_image -> fwrite -> signal handler -> png_write_info -> fwrite. Maybe gdb is confused here or the stack got screwed up. |
I am running into issues with hangs when trying to close the Gnuplot object, it's destructor appears to hang inside of an fclose command.
When this happens I am rendering a chart every few seconds, destroying it, and rendering another chart with new values.
My first suspicion was dangling newline or something causing gnuplot to wait for input but I cannot validate that idea.
I also ran the program in valgrind to make sure I wasn't corrupting memory or anything wonky.
Have you ran into this before? Seems only to happen on some machines I test it on and others can run through just fine without any hangs. Is my cycling running out of file descriptors or something? When it happens the machine has been constantly rendering charts for a few minutes.
Below is the stack trace. I have redacted unrelated function names on my side.
Appreciate any help.
The text was updated successfully, but these errors were encountered: