pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
109 stars 46 forks source link

Launched image get unresponsive after some time #488

Closed demarey closed 4 years ago

demarey commented 4 years ago

Describe the bug Reported by @Ducasse and @guillep: Launched image get unresponsive after some time. It looks like it happens with a self halt in the code and using the debugger.

To Reproduce Run tests Then I did $ kill -SIGUSR1 pid Somehow, that unblocked my image, but still produced a debug.log and a crash.dmp And then, when doing the signal, not only the image unblocks, but the launcher shows this:

PastedGraphic-1

So this means that the launcher is still attached to the process, but probably it’s not consuming the output in the standard streams (which makes our image lock up on write because the pipe’s buffer may be full?)

Expected behaviour Responsive image :)

Additional context It seems the process blocks when writing (an exception stack trace) to stdout

 0x7ffee50d1848 M [] in StdioStream(AbstractBinaryFileStream)>next:putAll: 0x1356fb2b8: a(n) StdioStream
    0x7ffee50d1878 M BlockClosure>on:do: 0x1191f5830: a(n) BlockClosure
    0x7ffee50d18c8 I StdioStream(AbstractBinaryFileStream)>next:putAll: 0x1356fb2b8: a(n) StdioStream
    0x7ffee50d1918 I StdioStream(AbstractBinaryFileStream)>nextPutAll: 0x1356fb2b8: a(n) StdioStream
    0x7ffee50d1960 I StdioStream(AbstractBinaryFileStream)>nextPut: 0x1356fb2b8: a(n) StdioStream
    0x7ffee50d19a8 I ZnUTF8Encoder>nextPutCodePoint:toStream: 0x1191f56f8: a(n) ZnUTF8Encoder
    0x7ffee50d19f8 I ZnUTF8Encoder(ZnCharacterEncoder)>nextPut:toStream: 0x1191f56f8: a(n) ZnUTF8Encoder
    0x7ffee50d1a48 I ZnCharacterWriteStream>nextPut: 0x1191f42e8: a(n) ZnCharacterWriteStream
    0x7ffee50d1a90 I ZnNewLineWriterStream>nextPut: 0x1191f5708: a(n) ZnNewLineWriterStream
    0x7ffee50d1ae0 M [] in SmalltalkImage>logStdErrorDuring: 0x1195be2f0: a(n) SmalltalkImage
    0x7ffee50d1b10 M BlockClosure>on:do: 0x1191f4298: a(n) BlockClosure
    0x7ffee50d1b68 I SmalltalkImage>logStdErrorDuring: 0x1195be2f0: a(n) SmalltalkImage
    0x7ffee50d1bb0 I SmalltalkImage>logError:inContext: 0x1195be2f0: a(n) SmalltalkImage
    0x7ffee50d1bf0 M [] in DebugSession>logStackToFileIfNeeded 0x1191f13c0: a(n) DebugSession
    0x7ffee50d1c20 M BlockClosure>on:do: 0x1191f3390: a(n) BlockClosure
    0x7ffee50d0538 M BlockClosure>ifError: 0x1191f3390: a(n) BlockClosure
    0x7ffee50d0570 M [] in DebugSession>logStackToFileIfNeeded 0x1191f13c0: a(n) DebugSession
    0x7ffee50d05b0 M BlockClosure>ensure: 0x1191f14b0: a(n) BlockClosure
    0x7ffee50d0600 M [] in BlockClosure>valueWithin:onTimeout: 0x1191f14b0: a(n) BlockClosure
    0x7ffee50d0630 M BlockClosure>on:do: 0x1191f1f00: a(n) BlockClosure
    0x7ffee50d06a0 I BlockClosure>valueWithin:onTimeout: 0x1191f14b0: a(n) BlockClosure
    0x7ffee50d06f0 I DebugSession>logStackToFileIfNeeded 0x1191f13c0: a(n) DebugSession
    0x7ffee50d0738 I MorphicUIManager>debugProcess:context:label:fullView:notification: 0x1180602e8: a(n) MorphicUIManager
    0x7ffee50d07a0 I MorphicUIManager(UIManager)>debugProcess:context:label:fullView: 0x1180602e8: a(n) MorphicUIManager
    0x7ffee50d0800 I Process>debug:title:full: 0x1371825e8: a(n) Process
    0x7ffee50d0858 I Process>debug:title: 0x1371825e8: a(n) Process
    0x7ffee50d08a8 I UnicornTimeout(Exception)>debug 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50d08e8 I MorphicUIManager>unhandledErrorDefaultAction: 0x1180602e8: a(n) MorphicUIManager
    0x7ffee50d0930 I UnhandledError>defaultAction 0x1191f0128: a(n) UnhandledError
    0x7ffee50d0968 M UndefinedObject>handleSignal: 0x11959ad80: a(n) UndefinedObject
    0x7ffee50d09a0 M Context>handleSignal: 0x11901fa28: a(n) Context
    0x7ffee50d09e0 M UnhandledError(Exception)>pass 0x1191f0128: a(n) UnhandledError
    0x7ffee50d0a20 I UnhandledError(Exception)>notifyUserOfCommand: 0x1191f0128: a(n) UnhandledError
    0x7ffee50d0a58 M ClyMethodContextOfFullBrowser(CmdToolContext)>processFailure:of: 0x11816c530: a(n) ClyMethodContextOfFullBrowser
    0x7ffee50d0a98 M CmdCommandActivator>processCommandFailure: 0x11813dba0: a(n) CmdCommandActivator
    0x7ffee50d0ad0 M [] in CmdCommandActivator>executeCommand 0x11813dba0: a(n) CmdCommandActivator
    0x7ffee50d0b08 M BlockClosure>cull: 0x118f22a00: a(n) BlockClosure
    0x7ffee50d0b48 M Context>evaluateSignal: 0x11901f970: a(n) Context
    0x7ffee50d0b80 M Context>handleSignal: 0x11901f970: a(n) Context
    0x7ffee50d0bb8 M Context>handleSignal: 0x11901f6f8: a(n) Context
    0x7ffee50d0bf0 M Context>handleSignal: 0x11901f480: a(n) Context
    0x7ffee50d0c28 M Context>handleSignal: 0x11901f3c8: a(n) Context
    0x7ffee50cc510 I UnhandledError(Exception)>signal 0x1191f0128: a(n) UnhandledError
    0x7ffee50cc550 I UnhandledError class>signalForException: 0x1195c2e70: a(n) UnhandledError class
    0x7ffee50cc598 I UnicornTimeout(Error)>defaultAction 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50cc5d0 M UndefinedObject>handleSignal: 0x11959ad80: a(n) UndefinedObject
    0x7ffee50cc610 M UnicornTimeout(Exception)>pass 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50cc648 M [] in WorldMorph>becomeActiveDuring: 0x119d33290: a(n) WorldMorph
    0x7ffee50cc680 M BlockClosure>cull: 0x118f21798: a(n) BlockClosure
    0x7ffee50cc6c0 M Context>evaluateSignal: 0x11901fa28: a(n) Context
    0x7ffee50cc6f8 M Context>handleSignal: 0x11901fa28: a(n) Context
    0x7ffee50cc738 M UnicornTimeout(Exception)>pass 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50cc778 I UnicornTimeout(Exception)>notifyUserOfCommand: 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50cc7c0 I ClyMethodContextOfFullBrowser(CmdToolContext)>processFailure:of: 0x11816c530: a(n) ClyMethodContextOfFullBrowser
    0x7ffee50cc810 I CmdCommandActivator>processCommandFailure: 0x11813dba0: a(n) CmdCommandActivator
    0x7ffee50cc848 M [] in CmdCommandActivator>executeCommand 0x11813dba0: a(n) CmdCommandActivator
    0x7ffee50cc880 M BlockClosure>cull: 0x118f22a00: a(n) BlockClosure
    0x7ffee50cc8c0 M Context>evaluateSignal: 0x11901f970: a(n) Context
    0x7ffee50cc8f8 M Context>handleSignal: 0x11901f970: a(n) Context
    0x7ffee50cc938 M UnicornTimeout(Exception)>pass 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50cc970 M [] in TestResult>runCaseForDebug: 0x118f23290: a(n) TestResult
    0x7ffee50cc9a8 M BlockClosure>cull: 0x118f23768: a(n) BlockClosure
    0x7ffee50cc9e8 M Context>evaluateSignal: 0x11901f6f8: a(n) Context
    0x7ffee50cca20 M Context>handleSignal: 0x11901f6f8: a(n) Context
    0x7ffee50cca70 I UnicornTimeout(Exception)>pass 0x1191ef940: a(n) UnicornTimeout
    0x7ffee50ccaa0 M [] in TestExecutionEnvironment>runTestCaseSafelly: 0x118f23790: a(n) TestExecutionEnvironment
    0x7ffee50ccae8 I BlockClosure>cull: 0x118f24c18: a(n) BlockClosure
    0x7ffee50ccb28 M Context>evaluateSignal: 0x11901f480: a(n) Context
    0x7ffee50ccb60 M Context>handleSignal: 0x11901f480: a(n) Context
    0x7ffee50ccb98 M Context>handleSignal: 0x11901f3c8: a(n) Context
    0x7ffee50ccbe0 I UnicornTimeout(Exception)>signal 0x1191ef940: a(n) UnicornTimeout

This is probably related to the fact that the launcher is now trying to listen to the stdout output to see if there is an error launching the process. @tesonep suggested: The PharoLauncher is taking the output of the launched stdout/stderr in a pipe. And as a Pipe has a limit, if the PharoLauncher is not removing elements from the pipe or it is done slowly, the producing process (the launched VM) will block until there is space in the pipe.

demarey commented 4 years ago

core problem is https://github.com/pharo-contributions/OSSubprocess/issues/58. Now check if image can be launched before launching to avoid to listen to stderr. See a8b29c04b2031b98fc6ceb8735c395833250fb7a