bugGNU Octave - Bugs: bug #49109, child process started by fork...


bug #49109: child process started by fork crashes or hangs with octave-gui

Submitted by:  None
Submitted on:  Sat 17 Sep 2016 12:36:54 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Segfault, Bus Error, etc.
Status:  Wont Fix Assigned to:  None
Originator Name:  Cygwin user Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  dev
Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 09 Mar 2019 09:06:08 PM UTC, comment #4: 

I'm closing this bug as won't fix.

I've recently learned that it's a well known problem that "fork without exec" does not work with large libraries and frameworks linked with a program, including Python, Qt, probably Java. In fact, it's considered deprecated on macOS now to 'fork' a process and not 'exec' a brand new executable image.

If the attached reproducer is changed to 'exec' a new program instead of executing Octave code or calling 'exit', it works perfectly even in octave-gui.

Calling 'fork' by itself for creating worker child processes should only be used carefully in small programs that don't link with large frameworks.


Mike Miller <mtmiller>
Project Administrator
Sun 03 Feb 2019 07:00:20 PM UTC, comment #3: 

Yes. The attached reworks it as a function, it works in octave-cli but not in octave-gui as originally reported.

(file #46171)

Mike Miller <mtmiller>
Project Administrator
Sun 03 Feb 2019 03:46:28 PM UTC, comment #2: 

Is this still valid?  I tried running the attached fork_test.m with the 5.0.90 release candidate and I get

error: fork: cannot be called from command line
error: called from
    fork_test at line 11 column 7

Rik <rik5>
Project Administrator
Fri 27 Apr 2018 07:14:47 PM UTC, comment #1: 

In recent version of Octave, a child process created by fork from octave-gui seems to hang and never exit. It does seem to work with octave-cli.

Mike Miller <mtmiller>
Project Administrator
Sat 17 Sep 2016 12:36:54 PM UTC, original submission:  

I'm using octave's fork function in order to parallelize tasks. However this is not working any longer in octave-4.0.1 on Cygwin64.
I have attached a very simple example (fork_test.m) which can be used to reproduce the problem.

$ octave --no-gui -q -f

>> fork_test

process 6504 started
process 6504 killed by signal 11

$ octave-cli -q -f
octave:1> fork_test
process 3964 started

process 3964 returned with code 0

That example works with octave-cli but fails with octave-gui. It should be mentioned, that only the child process receives the signal. The parent process never crashes. In the present example octave-gui crashes after the output has been saved and so one gets the expected results. But this is not true in general.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #46171:  fork49109.m added by mtmiller (501B - text/x-objcsrc)
file #38531:  fork_test.m added by None (701B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-09 mtmiller StatusConfirmed => Wont Fix
        Open/ClosedOpen => Closed
    2019-02-03 mtmiller Attached File- => Added fork49109.m, #46171
        StatusNeed Info => Confirmed
    2019-02-03 mtmiller Carbon-CopyRemoved 80942 => -
    2019-02-03 rik5 StatusNone => Need Info
    2018-04-27 mtmiller Priority5 - Normal => 3 - Low
        Release4.0.1 => dev
        Operating SystemMicrosoft Windows => Any
        SummaryOctave child process started by fork is killed by signal 11 (SIGSEGV) => child process started by fork crashes or hangs with octave-gui
    2016-09-17 None Attached File- => Added fork_test.m, #38531

    Back to the top

    Powered by Savane 3.7