Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8015082

(prefs) Preferences OS X extraneous files (sometimes crashes JVM)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 7u17, 8
    • core-libs
    • None

      FULL PRODUCT VERSION :
      initial tests on ...
      java version " 1.7.0_17 "
      Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      same results on ...
      java version " 1.8.0-ea "
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b80)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b21, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X Lion 10.7.5 (11G63)
      Darwin Lux.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

      Mac OS X 10.8.2 (12C60)
      Darwin eV.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Use Netbeans 7.3 beta and Netbeans 7.3 general release.

      Tested with same results on three machines: MacBook Pro and two different Mac Minis.

      A DESCRIPTION OF THE PROBLEM :
      A. extraneous files are create in /User/~/Library/Preferences such as ...

      806ac122-aea4-41c6-8760-2fc846a5b2d2.child_node_a.child_node_b.plist.lockfile
      806ac122-aea4-41c6-8760-2fc846a5b2d2.child_node_a.child_node_b.plist

      B. removing the preference nodes, flush() and sync() leave residual files in the Preferences folder.

      C. sometimes... Netbeans debugger will crash when stepping through the preferences junit test.

      A & B always happen.
      C. sometimes happens.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached JUnit test.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1. preference node paths to be contained in com.apple.java.util.prefs.plist

      2. preference node paths to be cleanly removed.
      ACTUAL -
      A. extraneous files are create in /User/~/Library/Preferences such as ...

      806ac122-aea4-41c6-8760-2fc846a5b2d2.child_node_a.child_node_b.plist.lockfile
      806ac122-aea4-41c6-8760-2fc846a5b2d2.child_node_a.child_node_b.plist

      B. removing the preference nodes, flush() and sync() leave residual files in the Preferences folder.

      C. sometimes... Netbeans debugger will crash when stepping through the preferences junit test.

      A & B always happen.
      C. sometimes happens.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.UUID;
      import java.util.prefs.BackingStoreException;
      import java.util.prefs.Preferences;
      import org.junit.After;
      import org.junit.AfterClass;
      import org.junit.Before;
      import org.junit.BeforeClass;
      import org.junit.Test;
      import static org.junit.Assert.*;

      /**
       *
       * @author marc
       */
      public class PreferencesTest {

          private String uuidStr;
          private Preferences testPrefs;

          public PreferencesTest() {
          }

          @BeforeClass
          public static void setUpClass() {
          }

          @AfterClass
          public static void tearDownClass() {
          }

          @Before
          public void setUp() throws BackingStoreException {
              uuidStr = UUID.randomUUID().toString();
              testPrefs = Preferences.userRoot().node(uuidStr);
              testPrefs.flush();
          }

          @After
          public void tearDown() throws BackingStoreException {
              testPrefs.removeNode(); // remove node and all descendants
              testPrefs.flush();
          }

          @Test
          public void hello() throws BackingStoreException {
              System.out.println( " ... Hello ... " );
              System.out.println( " ABSOLUTE PATH: " + testPrefs.absolutePath());

              // create relative child node abc
              Preferences childNodeABC = testPrefs.node( " CHILD_NODE_A/CHILD_NODE_B/CHILD_NODE_C " );
              String valueAbcUuid = UUID.randomUUID().toString();
              childNodeABC.put( " KEY_C " , valueAbcUuid);
              childNodeABC.flush();

              assertEquals(valueAbcUuid, childNodeABC.get( " KEY_C " , " NOT_FOUND " ));
              
              // create relative child node XYZ
              Preferences childNodeXYZ = childNodeABC.node( " CHILD_NODE_PART_X;PART_Y;PART_Z " );
              String valueXyzUuid = UUID.randomUUID().toString();
              childNodeXYZ.put( " KEY_Z " , valueXyzUuid);
              childNodeXYZ.flush();
              
              assertEquals(valueXyzUuid, childNodeXYZ.get( " KEY_Z " , " NOT_FOUND " ));

              childNodeABC.removeNode();
              testPrefs.sync();
          }
      }

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

            bchristi Brent Christian
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: