[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58678] Deadlock when deleting a figure while
From: |
Pantxo Diribarne |
Subject: |
[Octave-bug-tracker] [bug #58678] Deadlock when deleting a figure while another figure is beingdeleted |
Date: |
Mon, 29 Jun 2020 16:27:21 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0 |
URL:
<https://savannah.gnu.org/bugs/?58678>
Summary: Deadlock when deleting a figure while another figure
is beingdeleted
Project: GNU Octave
Submitted by: pantxo
Submitted on: lun. 29 juin 2020 20:27:19 UTC
Category: Plotting with OpenGL
Severity: 4 - Important
Priority: 5 - Normal
Item Group: Segfault, Bus Error, etc.
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: dev
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Details:
Here is a robust way to deadlock with Octave 5.1, stable and default:
hf = figure ();
hf2 = figure ();
addlistener (hf, "beingdeleted", @() delete (hf2));
delete (hf);
I dug into this and it turns out that this sequence provokes a recursive call
to F__go_delete__. This function uses an octave::autolock to lock the graphics
mutex and then unlock it at return. When graphics_toolkit::finalize is called,
the graphics mutex has been locked twice and using gh_manager::unlock is not
enough to unlock it (unlocking twice avoids the deadlock).
IOW, I just discovered that octave_mutex is a recursive mutex, and there is no
way to unlock it unless you know the number of times it has been previously
locked in the same thread. See also [1] for a discussion about recursive
mutexes.
So both qt_graphics_toolkit::initialize and finalize, can possibly deadlock.
PS: Contrary to what I have said in [2], our implementation of mutex is thus
very well suited for recursive use with octave::autolock.
PPS: I tagged this bug as segfault since a deadlock looks as critical.
[1] http://www.zaval.org/resources/library/butenhof1.html
[2]
https://octave.1599824.n4.nabble.com/segfaults-in-graphics-code-likely-threading-issues-td4697518.html
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58678>
_______________________________________________
Message posté via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #58678] Deadlock when deleting a figure while another figure is beingdeleted,
Pantxo Diribarne <=