Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-3626

setDocumentExpiration hangs inside a batch transaction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.0
    • 3.0.2
    • LiteCore
    • Security Level: Public
    • None
    • Jim 87
    • 3

    Description

       - Steps to Reproduce: 

       

      @Test
      public void testHangInBatch() throws CouchbaseLiteException {
          final int nDocs = 10;
          // Save 10 docs:
          createDocsInBaseTestDb(nDocs);
       
          baseTestDb.inBatch(() -> {
              long now = new Date().getTime();
              for (int i = 0; i < nDocs; i++) {
                  String docID = String.format(Locale.US, "doc_%03d", i);
                  Document doc = baseTestDb.getDocument(docID);
                  MutableDocument mutableDocument = doc.toMutable();
       
                  mutableDocument.setString("type", "TrashBinModel");
                  mutableDocument.setString("dateOfDeletion", String.valueOf(now));
                  baseTestDb.save(mutableDocument);
                  baseTestDb.setDocumentExpiration(mutableDocument.getId(), new Date(now + 50000));
              }
          });
      } 

       

       

       - Actual Result: Test hangs
       - Expected Result: Test passes
       - Upon using the android debugger, I see that the hang happens when trying to get the file lock inside reopen: https://github.com/couchbase/couchbase-lite-core/blob/4b4b513579e35b78ff70d616d0c6886100a76c96/LiteCore/Storage/SQLiteDataFile.cc#L215

       - Logcat: testHangInBatch.txt

      Attachments

        Issue Links

          Activity

            People

              jimb Jim Borden
              lauren.nguyen Lauren Nguyen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty