You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you create a process with either input or output piped into an InputStream or OutputStream, and destroy the process before it terminates naturally, two threads are created but not destroyed (two per pipe, so if both input and output are piped, this comes to four threads).
The issue does not occur if the process is allowed to terminate of its own accord.
The cause of the issue appears to be the variables currentSink and currentSource. If the process is allowed to terminate naturally, these are set to None, signalling to the pipe processes that they should exit (lines 135-138 in processImpl.scala). However, if the process is terminated by the destroy() method, no such cleanup is done (lines 143-144).
I've attached a script that triggers the issue.
I'm working on a patch for this, but I'm a first time contributor to the scala codebase, so it might take a while to familiarise myself with the process.
The text was updated successfully, but these errors were encountered:
If you create a process with either input or output piped into an InputStream or OutputStream, and destroy the process before it terminates naturally, two threads are created but not destroyed (two per pipe, so if both input and output are piped, this comes to four threads).
The issue does not occur if the process is allowed to terminate of its own accord.
The cause of the issue appears to be the variables currentSink and currentSource. If the process is allowed to terminate naturally, these are set to None, signalling to the pipe processes that they should exit (lines 135-138 in processImpl.scala). However, if the process is terminated by the destroy() method, no such cleanup is done (lines 143-144).
I've attached a script that triggers the issue.
I'm working on a patch for this, but I'm a first time contributor to the scala codebase, so it might take a while to familiarise myself with the process.
The text was updated successfully, but these errors were encountered: