Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5283

Crash / process termination during SYSCS_DISABLE_LOG_ARCHIVE_MODE can leave service.properties broken



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s:,
    • Fix Version/s:,
    • Component/s: Miscellaneous
    • Labels:
    • Environment:
    • Bug behavior facts:
      Data corruption, Seen in production


      If Derby is terminated while SYSCS_DISABLE_LOG_ARCHIVE_MODE is being called service.properties can be left in a broken state.

      Depending on timing either of the two cases can happen:
      Case 1:
      "ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold' " is thrown when next trying to call
      SYSCS_DISABLE_LOG_ARCHIVE_MODE(1). Both "service.properties" and "service.propertiesold" are present in the database directory. Removing "service.propertiesold" corrects the problem.

      Case 2:
      "SQLException: Database 'C:\PATH_TO_DB' not found" is thrown when booting the database. The file service.properties does not exist in the database directory but service.propertiesold does exist. Renaming the file back to "service.properties" corrects the problem.

      As mentioned above both cases have workarounds but they require manual intervention which is a problem for applications installed to a customer site. It would be great if a more reliable method to update the file could be found.

      The following sample code will reproduce the issue fairly reliably by terminating the java process:

      import java.sql.*;
      import org.apache.derby.jdbc.*;

      public class DerbyLogArchiveModeTest {

      public static void main(String[] args) {
      final EmbeddedDataSource ds = new EmbeddedDataSource();

      try {
      final Connection conn = ds.getConnection();

      try {
      final Statement stmt = conn.createStatement();

      try {
      while (true)

      { stmt.execute("call SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE(1)"); }

      } finally

      { stmt.close(); }

      } finally

      { conn.close(); }

      } catch (SQLException e)

      { e.printStackTrace(); }



        1. derby-5283-2a-update_test_with_errorcodes.diff
          1 kB
          Kristian Waagan
        2. derby-5283-1c-recover.diff
          34 kB
          Kristian Waagan
        3. derby-5283-1b-recover.diff
          34 kB
          Kristian Waagan
        4. derby-5283-1a-recover.diff
          19 kB
          Kristian Waagan
        5. derby-5283_10_8_diff.txt
          27 kB
          Katherine Marsden

          Issue Links



              • Assignee:
                kristwaa Kristian Waagan
                b.mason@adinstruments.com Brett Mason
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: