-
Notifications
You must be signed in to change notification settings - Fork 5
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
Programs launched with 'launch' crash if they try to use stderr after X seconds #4
Comments
Update: Turns out that this has not been resolved entirely. I have updated the fist post above to reflect the current situation. For a description on the intended behavior of the Test case 1:
Test case 2:
Test case 2:
We need someone with a deep understanding of processes, threads, stdout, stderr, detaching, forking, exec'ing etc. to have a deep look at the code. Possibly a deeper understanding of how QProcess works (I suspect it is using threads internally?) is required, and possibly we need to replace it with a pure C/C++ solution? Here is the code in question: Lines 290 to 326 in 9273d38
Once the payload appliacation process gets detached, trying to write to stdout/stderr fails and leads to the crash? Experimenting with
I could not get resolve this. |
Traces made like this:
good.txt = when not launched through |
This is a minimal proof that the crash occurs when programs try to use
Test case:
|
...and this is
12316 is How can I fix this in Full log (another run, so different PIDs): |
If we do this then we don't crash but we can't display the error in the GUI because it gets printed to stderr:
Is there a way to "duplicate" stderr, so that during the first X seconds we can print it on the console but also can somehow intercept/access it (e.g., using Something along those lines ("named pipe") may be needed? This seems to talk about a similar challenge but it is way over my head: |
launch
command, then it will exit as soon as it wants to print something to stdout and/or stderr after thep.waitForFinished period
has elapsedNo output is printed to stdout at all before thefixed usingp.waitForFinished period
has elapsedp.setProcessChannelMode(QProcess::ForwardedChannels);
launch Menu
is used to launch the global menu bar, then it will exit if thep.waitForFinished period
has elapsed and the user then selects any menu item from the System menu (but not from some other menus). Possibly because selecting commands from the System menu makes liberal use ofqDebug()
to print debug information to the console?qpdf
is launched with thelaunch
command, then it will exit after thep.waitForFinished period
(when set to 3 seconds, possibly because around 3 seconds it wants to writeQKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
to stderr). Why? (Setting a longerp.waitForFinished period
might do away with this immediate crash because then theQKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
is already written to stderr?)Withfixed usingp.waitForFinished period
set to 10 seconds, then theping
command will exit after 10 seconds, and only then show the output of theping
commandp.setProcessChannelMode(QProcess::ForwardedChannels);
Once this is solved, set the time back to e.g., 3 seconds rather than 10.
The text was updated successfully, but these errors were encountered: