Truncated Output or Killed Child Process When Output Streamer Suppresses UnicodeDecodeError
Exceptions from popen_process.stdout.readline()
#1141
Labels
bug
A crash or error in behavior.
Describe the bug
Practically all processes are opened in
text
mode such thatsubprocess
automatically decodes all piped output. While these processes are running, the output streamer continuously readsstdout
withreadline()
so it can be logged. Additionally, this is wrapped in atry/except
forValueError
which is suppressed because the process should be dead; this can manifest when a user spams CTRL+C, for instance, causing the process to closestdout
on its end.Given all this, the call to
readline()
onstdout
can throw aUnicodeDecodeError
for invalid data given the codec for decoding; sinceUnicodeDecodeError
subclassesValueError
, this exception is suppressed.Once this occurs, the output streamer waits 3 seconds for the processes to terminate...after which it forcibly kills it. This can result in truncated output (if the process happens to terminate within 3 seconds) or the process can be forcibly killed for seemingly no reason.
Steps to reproduce
I have been encountering this when using a forked copy of the linuxdeploy GTK plugin when the
DEBUG
environment variable is set while testing #1132.I haven't been able to assess whether this is something in my environment...or an issue with the plugin.
Expected behavior
The "bad" data should be accommodated such that normal operation of Briefcase isn't affected. So, some setting of
errors
should probably be used withsubprocess
.Screenshots
No response
Environment
0.3.13.dev180+g18f59eef.d20230319
Logs
This log includes the exception since I updated the output streamer to re-raise.
briefcase.2023_03_19-18_52_42.build.log
Additional context
No response
The text was updated successfully, but these errors were encountered: