Description
- Steps to Reproduce:
- clone and build project: https://github.com/couchbaselabs/couchbase-lite-java-ee-root, either master or android/release/3.0 branch in Android Studio (note that android debugger can only step into core codes in 3.0)
- run unit test (test is created based on user's code: https://forums.couchbase.com/t/android-v3-0-0-setdocumentexpiration-hangs-when-is-used-inside-inbatch/33604)
@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
- relates to
-
CBL-3135 Correct/document DB operations allowed in a batch transaction
- Closed