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

Meta-data for unknown could not be accessed to read

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.14.2.0
    • None
    • SQL, Store
    • None
    • Windows 10
    • Seen in production

    Description

      Hi,

       

      I'm afraid I don't have a reproducible case for this, but it's an issue we've seen in the wild on customer's machines. I'd guess it's specific to Windows, as other platforms don't support exclusive locks, and we've only ever seen it reported from Windows users.

       

      The `ConcurrentCache` in the stacktrace makes me wonder if Derby is able to lock itself out of the database under the right conditions. Here's the trace:

       

      Caused by: java.sql.SQLException: Meta-data for unknown could not be accessed to read C:\Users\USER\.ScreamingFrogSEOSpider\ProjectInstanceData\6b422f28-46c9-492e-bbde-aeb5bc1e6307\results_10505723-008c-4b06-aa69-2c676ef858c8\sql\seg0\c71.dat
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java)
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java)
      	at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java)
      	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java)
      	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java)
      	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java)
      	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java)
      	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java)
      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java)
      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java)
      	at uk.co.screamingfrog.seospider.db.AbstractDuplicateTableOperations.getSpiderUrls(AbstractDuplicateTableOperations.java:152)
      	... 17 more
      Caused by: ERROR XSDG3: Meta-data for unknown could not be accessed to read C:\Users\USER\.ScreamingFrogSEOSpider\ProjectInstanceData\6b422f28-46c9-492e-bbde-aeb5bc1e6307\results_10505723-008c-4b06-aa69-2c676ef858c8\sql\seg0\c71.dat
      	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java)
      	at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java)
      	... 28 more
      Caused by: java.io.FileNotFoundException: C:\Users\USER\.ScreamingFrogSEOSpider\ProjectInstanceData\6b422f28-46c9-492e-bbde-aeb5bc1e6307\results_10505723-008c-4b06-aa69-2c676ef858c8\sql\seg0\c71.dat (The process cannot access the file because it is being used by another process)
      	at java.base/java.io.RandomAccessFile.open0(Native Method)
      	at java.base/java.io.RandomAccessFile.open(Unknown Source)
      	at java.base/java.io.RandomAccessFile.<init>(Unknown Source)
      	at java.base/java.io.RandomAccessFile.<init>(Unknown Source)
      	at org.apache.derby.impl.io.DirRandomAccessFile.<init>(DirRandomAccessFile.java)
      	at org.apache.derby.impl.io.DirFile.getRandomAccessFile(DirFile.java)
      	at org.apache.derby.impl.store.raw.data.RAFContainer.run(RAFContainer.java)
      	at java.base/java.security.AccessController.doPrivileged(Native Method)
      	at org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(RAFContainer.java)
      	at org.apache.derby.impl.store.raw.data.RAFContainer4.openContainer(RAFContainer4.java)
      	at org.apache.derby.impl.store.raw.data.FileContainer.setIdent(FileContainer.java)
      	at org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(FileContainer.java)
      	at org.apache.derby.impl.services.cache.ConcurrentCache.find(ConcurrentCache.java)
      	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(BaseDataFileFactory.java)
      	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(BaseDataFileFactory.java)
      	at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java)
      	at org.apache.derby.impl.store.access.btree.OpenBTree.init(OpenBTree.java)
      	at org.apache.derby.impl.store.access.btree.BTreeScan.init(BTreeScan.java)
      	at org.apache.derby.impl.store.access.btree.index.B2IForwardScan.init(B2IForwardScan.java)
      	at org.apache.derby.impl.store.access.btree.index.B2I.openScan(B2I.java)
      	at org.apache.derby.impl.store.access.RAMTransaction.openScan(RAMTransaction.java)
      	at org.apache.derby.impl.store.access.RAMTransaction.openScan(RAMTransaction.java)
      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndexMinion(DataDictionaryImpl.java)
      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java)
      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptorIndex1Scan(DataDictionaryImpl.java)
      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getUncachedTableDescriptor(DataDictionaryImpl.java)
      	at org.apache.derby.impl.sql.catalog.NameTDCacheable.setIdentity(NameTDCacheable.java)
      	at org.apache.derby.impl.services.cache.ConcurrentCache.find(ConcurrentCache.java)
      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptor(DataDictionaryImpl.java)
      	at org.apache.derby.impl.sql.compile.QueryTreeNode.getTableDescriptor(QueryTreeNode.java)
      	at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java)
      	at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java)
      	at org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java)
      	at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java)
      	at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java)
      	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java)
      	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java)
      	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java)
      	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java)
      	at org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java)
      	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java)
      	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java)
      	... 21 more 

       

      The exception message mentions "another process", but it's possible to get exactly this error message in a single Java application:

       

      public static void main(
          final String[] args) throws Exception
      {
          final Path path = Path.of("lock");
          path.toFile().createNewFile();
      
          try (final FileChannel channel = FileChannel.open(path, StandardOpenOption.APPEND))
          {
              channel.lock(0, Long.MAX_VALUE, false);
              System.out.println("Locked");
      
              final FileInputStream fis = new FileInputStream(path.toFile());
              fis.readAllBytes();
      
              System.out.println("Done");
          }
      } 

       

      On Windows, this will throw a similar exception. 

       

      If, however, it is a problem caused by some other piece of software (such as antivirus or backup software), is there a way for Derby to use this same locking mechanism to lock out those other applications?

      Attachments

        Activity

          People

            Unassigned Unassigned
            samhutchins Sam Hutchins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: