JDK-6721086 : Toolkit beep does not work consistently
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2008-07-01
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b64Fixed OpenJDK6Fixed
Description
FULL PRODUCT VERSION :
openjdk version "1.6.0-internal"
OpenJDK Runtime Environment (build 1.6.0-internal-langel_02_jun_2008_10_58-b00)
OpenJDK Server VM (build 10.0-b19, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux towel.yyz.redhat.com 2.6.25.6-55.fc9.i686 #1 SMP Tue Jun 10 16:27:49 EDT 2008 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Triggering a beep using the default toolkit only works occasionally. This is because the awt is not unlocked/flushed properly.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run test case a few times. beep will only occur intermittently depending on the XToolkit instance cached (See the hashcode of the Toolkit printed out).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Beep should be heard every time the testcase is run.
ACTUAL -
Beep is not heard every time, only with certain cached instances of the toolkit.

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
import java.awt.*;

public class beepTest {

  public static void main(String[] args) {
    System.out.println(Toolkit.getDefaultToolkit());
    Toolkit.getDefaultToolkit().beep();
  }

}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Here is a patch:


--- openjdk6.old/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java      2008-03-26 05:00:00.000000000 -0400
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java   2008-06-26 11:59:28.000000000 -0400
@@ -1097,7 +1097,7 @@
         try {
             XlibWrapper.XBell(getDisplay(), 0);
         } finally {
-            awtUnlock();
+            awtFUnlock();
         }
     }

Comments
EVALUATION https://bugs.openjdk.java.net/show_bug.cgi?id=100075 http://mail.openjdk.java.net/pipermail/awt-dev/2009-June/000663.html
18-06-2009