-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to write revision with attachment #802
Comments
Here is a second time launch application log (use CBLDatabase, ChangeTracker, RemoteRequest, Sync log chanels) https://gist.github.com/ryuzmukhametov/cad86667b86d993348be |
491 is What is the exact server you're using? |
Thanks for the logs. From the server URL This sounds like #786 except you're not getting the same warning message. But it's probably also related to the fact that recent versions of CouchDB have started including MIME headers in their attachment multipart bodies. |
I use Apache CouchDB version 1.6.1 |
OK, I can reproduce it (with the latest master branch). The error occurs at CBLDatabase+Attachments.m:350: if (status == kCBLStatusOK || status == kCBLStatusNotFound)
status = kCBLStatusBadAttachment; The attachment being processed is a stub but the local db doesn't have the parent revision, so it fails. It should be looking farther back in the rev history, since in this case there are several missing revs between the one being inserted and the last one that's known locally. |
That was a nasty little edge case — thanks for reporting it. Only happened when pulling from CouchDB, because CouchDB identifies attachments with MD5 digests instead of SHA-1, so our code can't look up the attachment by its digest. |
FYI, you should be able to cherry-pick this fix onto the 1.1 branch. At this point that would be safer than trying to use the master branch (too many brand-new changes.) You'll also want to pick up the other CouchDB compatibility fix (see #786.) |
Thank you, Jens, now it works for me! |
Nasty edge case where the attachment is unchanged, but the parent rev isn't available (doc was changed multiple times remotely), _and_ the attachment metadata doesn't contain a usable digest (CouchDB's digests are MD5 not SHA-1.) Fixes couchbase#802
Nasty edge case where the attachment is unchanged, but the parent rev isn't available (doc was changed multiple times remotely), _and_ the attachment metadata doesn't contain a usable digest (CouchDB's digests are MD5 not SHA-1.) Fixes #802
In my app sometimes when a document with attachment is pulled I get next warning:
As result the pull replication is stopped. Moreover it is impossible to start pull replication even it uses start or restart methods.
Next steps show how reproduce it in 'CBL iOS Test App' (sha commit: 9aa3bce)
When the app start it can't pull revision from remote server.
Sample code for create document with attachment (I call it from viewWillAppear):
It occurs when I use SQLite and ForestDB data storage.
The text was updated successfully, but these errors were encountered: