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 25 Feb 2017 04:42:14 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Assigned to:  None
Originator Name:  Olaf Till Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 25 Feb 2017 09:49:08 PM UTC, 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>
Project Member
Sat 25 Feb 2017 08:08:58 PM UTC, 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>
Project Member
Sat 25 Feb 2017 04:54:10 PM UTC, 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>
Project Member
Sat 25 Feb 2017 04:42:14 PM UTC, 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>
Project Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.3