-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 11, 17, 21, 25, 26
-
Component/s: client-libs
-
master
-
x86_64
-
linux
ADDITIONAL SYSTEM INFORMATION :
Linux Ubuntu 24.04LTS, JDK 25.0.1 and earlier
A DESCRIPTION OF THE PROBLEM :
The JNI function Java_sun_awt_X11_GtkFileDialogPeer_run() in src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c
acquires GDK lock calling gtk->gdk_threads_enter().
After having done this, there are 3 if-cases where the function returns without properly releasing the lock.
This will cause a deadlock on next try to acquire the lock.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please check out src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c, function Java_sun_awt_X11_GtkFileDialogPeer_run().
It acquires the lock here:
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L327
At the following 3 locations the function returns without properly releasing the lock:
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L333
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L365
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L377
The lock is only released, if the function reaches its end.where it calls gtk->gdk_threads_leave().
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The function calls gtk->gdk_threads_leave() in any branch before it returns.
ACTUAL -
The function returns in 3 cases with the lock still held causing deadlock on next attempt to acquire GDK lock.
Linux Ubuntu 24.04LTS, JDK 25.0.1 and earlier
A DESCRIPTION OF THE PROBLEM :
The JNI function Java_sun_awt_X11_GtkFileDialogPeer_run() in src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c
acquires GDK lock calling gtk->gdk_threads_enter().
After having done this, there are 3 if-cases where the function returns without properly releasing the lock.
This will cause a deadlock on next try to acquire the lock.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please check out src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c, function Java_sun_awt_X11_GtkFileDialogPeer_run().
It acquires the lock here:
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L327
At the following 3 locations the function returns without properly releasing the lock:
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L333
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L365
https://github.com/openjdk/jdk/blob/4913b548a79a981816718def38d059b5175f6f59/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c#L377
The lock is only released, if the function reaches its end.where it calls gtk->gdk_threads_leave().
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The function calls gtk->gdk_threads_leave() in any branch before it returns.
ACTUAL -
The function returns in 3 cases with the lock still held causing deadlock on next attempt to acquire GDK lock.
- links to
-
Commit(master)
openjdk/jdk/8a0c47d4
-
Review(master)
openjdk/jdk/28177