As part of gsa managing gsc stdoio the gsc stdio is closed, before the actual process is shutdown, if shutdown contains logging that eventually print to stdout this will cause the shutdown to hang.
GSC prints "gsa-exit-done" to stdout
GSA reads "gsa-exit-done" and stops GSProcess.ProcessReader
GSC continues to write stuff to stdout, but nobody is consuming it. This works for a while until stdio pipeline cache size is reached. Then it blocks forever.
Proposed fix. Only stop consuming stdout after GSA.ImplProcessMonitor detects shutdown of GSC. Which it already does, so actually only remove "gsa-exit-done" hook.
In Reproducible customer create class ParentProcess which represent a GSA and then there is the class ChildProcess which play the role of a GSC/GSM or similar. In method ChildProcess.shutdown you can easly increase or decrease the amount of data written to stdout after shutdown.
Thread dump attached.