bugGNU Octave - Bugs: bug #50400, exit() in forked child doesn't...

 
 

bug #50400: exit() in forked child doesn't return

Submitted by:  Olaf Till <i7tiol>
Submitted on:  Sat Feb 25 16:42:14 2017  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: NoneAssigned to: None
Originator Name: Olaf TillOpen/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat Feb 25 21:49:08 2017, comment #3:

Well, hacked a wrapper class around a QMutex*, adding a reinit method. But it seems I was wrong, and the problem is not with the mutex at all. The child doesn't hang in trying to lock the mutex.

Rather, it hangs in waiting for another thread to signal a condition (GUI shut down). It's clear that it must wait forever, since there is no further thread any more in the child.

So again, not clear what to do.

Olaf Till <i7tiol>
Sat Feb 25 20:08:58 2017, comment #2:

At exit(), octave_qt_link::do_confirm_shutdown() tries to lock a QMutex (which, since it's constructed before forking, is unusable in the child).

QMutex is initialized at construction, doesn't provide a method for re-initialization, and has copying disabled. So it can't be made usable again in the forked child.

What can be done to prevent the child from deadlocking at exit()?

Olaf Till <i7tiol>
Sat Feb 25 16:54:10 2017, comment #1:

Maybe something similar to the last patch in bug #47478 should be done, registering (with pthread_at_fork()) functions to be called at fork() time, which should care for the QT threads and (otherwise non-functional) QT mutexes in the child.

Olaf Till <i7tiol>
Sat Feb 25 16:42:14 2017, original submission:

dev branch, 2bed6d6bb2e2, 2017-02-24 11:43:56-0800
with QT, started with ./run-octave, with or without option --no-gui.

After fork (i.e. the fork builtin), exit() in the child makes the child (and so the parents waitpid()) hang. Reproduce with:

Backtrace of the hanging child:

so it waits for some mutex in QT.

exit(0) in an unforked session works o.k..

Olaf Till <i7tiol>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by i7tiol (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1