Skip to content
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

VM Crash when forking infinitive process and image restart #12

Closed
marianopeck opened this issue Jan 17, 2016 · 1 comment
Closed

VM Crash when forking infinitive process and image restart #12

marianopeck opened this issue Jan 17, 2016 · 1 comment
Labels

Comments

@marianopeck
Copy link
Collaborator

If you execute a command that does a fork at Pharo level, and the process runs forever unless explicitly terminated (like tail) AND you don't terminate AND you quite the image, then the next time you start the image, the process will continue trying to do the waitForExit which does the queryExitStatus, which does the waitpid, which of course throws error because the process at the OS level does not exist anymore. Then, the StartupUIManager kills the VM if there is an error at startup.

An example of the process code is this:

    | streamsInfo totalStdout totalStderr page playground |
    totalStdout := String new writeStream.
    totalStderr := String new writeStream.
    (page := GTPlayPage new)
        saveContent: 'initial content'.
    (playground := GTPlayground new)
        openOn: page.

    [
        OSSUnixSubprocess new
        command: 'tail';
        arguments: #('-f' '/var/log/system.log' );
        redirectStdout;Ω
        redirectStderr;
        runAndWaitPollingEvery: (Delay forMilliseconds: 500) 
        doing: [ :process :outStream :errStream |  
            | read | 
            read := outStream upToEnd.
            page saveContent: (page content, read).
            playground update.
            totalStdout nextPutAll: read.
            errStream upToEnd.
        ]
        onExitDo: [ :process :outStream :errStream  |
            process closeAndCleanStreams.
        ]
    ] fork.

And the VM crash looks as this (built a VM for debug and put a breakpoint in _exit):

(gdb) call printAllStacks()
Process 0x223c4618 priority 40
0xbff635a0 I SmalltalkImage>exitFailure 0x204bf220: a(n) SmalltalkImage
0xbff635b8 M [] in StartupUIManager(CommandLineUIManager)>exitFailure 0x1f5ec448: a(n) StartupUIManager
0xbff635d8 M BlockClosure>ensure: 0x1f749380: a(n) BlockClosure
0xbff635fc I StartupUIManager(CommandLineUIManager)>exitFailure 0x1f5ec448: a(n) StartupUIManager
0xbff63614 M [] in StartupUIManager(CommandLineUIManager)>quitFrom:withMessage: 0x1f5ec448: a(n) StartupUIManager
0xbff63634 M BlockClosure>ensure: 0x1f5ee948: a(n) BlockClosure
0xbff63658 I StartupUIManager(CommandLineUIManager)>quitFrom:withMessage: 0x1f5ec448: a(n) StartupUIManager
0xbff63680 I StartupUIManager(CommandLineUIManager)>unhandledErrorDefaultAction: 0x1f5ec448: a(n) StartupUIManager
0xbff636a4 I UnhandledError>defaultAction 0x1f5eeac0: a(n) UnhandledError
0xbff636c0 M UndefinedObject>handleSignal: 0x1fb75b00: a(n) UndefinedObject
0xbff636dc M UnhandledError(Exception)>signal 0x1f5eeac0: a(n) UnhandledError
0xbff636fc I UnhandledError class>signalForException: 0x1fde0f70: a(n) UnhandledError class
0xbff63720 I Error>defaultAction 0x1f5eeaa0: a(n) Error
0xbff6373c M UndefinedObject>handleSignal: 0x1fb75b00: a(n) UndefinedObject
0xbff63758 M Error(Exception)>signal 0x1f5eeaa0: a(n) Error
0xbff63770 M Error(Exception)>signal: 0x1f5eeaa0: a(n) Error
0xbff6378c M OSSUnixSystemAccessor(Object)>error: 0x21fe1178: a(n) OSSUnixSystemAccessor
0xbff637b4 I OSSUnixSystemAccessor>strerror:message: 0x21fe1178: a(n) OSSUnixSystemAccessor
0xbff637e8 I [] in OSSUnixSystemAccessor>waitpidNoHang: 0x21fe1178: a(n) OSSUnixSystemAccessor
0xbff63808 M BlockClosure>ensure: 0x1f5eef30: a(n) BlockClosure
0xbff63834 I OSSUnixSystemAccessor>waitpidNoHang: 0x21fe1178: a(n) OSSUnixSystemAccessor
0xbff63858 I OSSUnixSubprocess>queryExitStatus 0x223c2f70: a(n) OSSUnixSubprocess
0xbff63878 I OSSUnixSubprocess>waitForExitPollingEvery:doing: 0x223c2f70: a(n) OSSUnixSubprocess
0x223b50f0 s OSSUnixSubprocess>runAndWaitPollingEvery:doing:onExitDo:
0x223c3140 s [] in OSSUnixSubprocessTest>(nil)
0x223c31c0 s [] in BlockClosure>newProcess
@marianopeck
Copy link
Collaborator Author

OK, I fixed this by implementing a stopWaiting method which will be send for all active children in system shutdown and startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant