Derby
  1. Derby
  2. DERBY-4917

zero byte dbex.lck file can cause dual boot warning saying Severe and non-recoverable corruption can result and may have already occurred.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1.2.1
    • Fix Version/s: None
    • Component/s: Store
    • Environment:
    • Urgency:
      Normal
    • Issue & fix info:
      Workaround attached
    • Bug behavior facts:
      Seen in production

      Description

      User reports the following warning booting Derby 10.2 with JDK 1.5 SR11 FP1 on z/OS.

      ij> connnect 'jdbc:derby:wombat';
      IJ ERROR: Unable to establish connection
      ij> connect 'jdbc:derby:wombat';
      WARNING: Derby (instance c013800d-012c-8027-19b4-000000037b18) is attempting to
      boot the database <snip dbname > even though Derby (instance c0
      13800d-012c-74ae-07c3-0000000af3f0) may still be active. Only one instance of D
      erby should boot a database at a time. Severe and non-recoverable corruption can
      result and may have already occurred.

      The dbex.lck file is zero length. The code seems to indicate in DirFile4.getExclusiveLock() that a zero length dbex.lck file is possible if the product is booted with less than JDK 1.4 and Derby should show the warning under these circumstances, but investigation shows that even if the dbex,lck file is removed it is recreated with zero length using JDK 1.5. So there seem to be two issues.
      1) dbex.lck is somehow getting created with zero length with JDK 1.5 on this machine with JDK 1.5 SR11 FP1.

      2) We have this logic pertaining to JDK 1.3.1 in the product that probably can be removed and perhaps masks a real exclusive locking problem that perhaps should issue an Error rather than a warning if the file cannot be created with 4 bytes as expected.

      I can mimic the Warning on my system with a manufactured zero length dbex.lck file e.g.
      mv dbex.lck dbex.lck.orig
      touch dbex.lck
      java org.apache.derby.tools.ij
      ij version 10.2
      ij> connnect 'jdbc:derby:wombat';
      IJ ERROR: Unable to establish connection
      ij> connect 'jdbc:derby:wombat';
      WARNING: Derby (instance c013800d-012c-8027-19b4-000000037b18) is attempting to
      boot the database /u/kmarsd/repro/lockwarn/wombat even though Derby (instance c0
      13800d-012c-74ae-07c3-0000000af3f0) may still be active. Only one instance of D
      erby should boot a database at a time. Severe and non-recoverable corruption can
      result and may have already occurred.

      I see the same warning with 10.7.

      Possible workaround for eliminating the warning is to do a clean shutdown of the derby database before exiting the jvm which will remove the lck files, but it is hard to know if the user is getting actual dual boot protection under these circumstances.

      1. SimpleConnect.java
        1 kB
        Kathey Marsden
      2. ExLockFile.java
        6 kB
        Kathey Marsden
      3. derby-4917_10_2_debug_diff.txt
        8 kB
        Kathey Marsden

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development