Failed to write revision with attachment

11 views
Skip to first unread message

Rustam Yuzmukhametov

unread,
Jul 2, 2015, 10:28:54 AM7/2/15
to mobile-c...@googlegroups.com
In my app sometimes when a document with attachment is pulled I get next warning:
19:06:15.987‖ WARNING: CBL_Puller[http://localhost:5984/a] failed to write {my_doc_id #4-a0716cf34b240d1dec1ef7ada408063e}: status=491
As result the pull replication is stopped. Moreover it is impossible to start pull replication even it use start or restart methods.

Next steps show how reproduce it in 'CBL iOS Test App' (sha commit: 9aa3bce43341d42df014595fdfbdb3bdc9f29e61)
- Configure the app with syncpoint
- Launch the application and create a document with attachment (see 'createDocument With Attachment' below). The document is pushed to the server.
- Stop application
- Change document many times in the server (more than one time)
- Start the app

When the app start it can't pull revision from remote server.

Sample code for create document with attachment (I call it from viewWillAppear):

- (void)createDocumentWithAttachment
{
   
NSString *docId = @"my_doc_id";
   
CBLDatabase *db = self.database;
   
CBLDocument *doc = [db documentWithID:docId];
   
CBLSavedRevision *rev = [doc putProperties:@{@"key":@"value"} error:nil];
   
NSLog(@"rev = %@", rev.revisionID);
   
NSString* str = @"teststring";
   
NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];
   
NSString *contentType = @"text/plain";
   
CBLSavedRevision *currentRevision = rev;
   
CBLUnsavedRevision *unsavedRevision = [currentRevision createRevision];
   
[unsavedRevision setAttachmentNamed:@"my_attachment" withContentType:contentType content:data];
    currentRevision
= [unsavedRevision save:nil];
   
NSLog(@"%@", currentRevision.revisionID);
}

Second time launch application file log is in attachment (use CBLDatabase, ChangeTracker, RemoteRequest, Sync log chanels)
It occurs when I use SQLite and ForestDB data storage.

log.txt

Jens Alfke

unread,
Jul 2, 2015, 12:26:03 PM7/2/15
to mobile-c...@googlegroups.com
This is a great bug report! But bug reports should be filed in the Github issue tracker. Could you add it there, please? That way you’ll get notified of updates.

—Jens

Rustam Yuzmukhametov

unread,
Jul 2, 2015, 2:39:46 PM7/2/15
to mobile-c...@googlegroups.com
Thank you for response Jens. I've created https://github.com/couchbase/couchbase-lite-ios/issues/802

четверг, 2 июля 2015 г., 21:26:03 UTC+5 пользователь Jens Alfke написал:
Reply all
Reply to author
Forward
0 new messages