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.

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/a50dfe16-ac0d-462e-9252-ea12fdfc48bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
19:06:15.802| Logging CBLDatabase, ChangeTracker, RemoteRequest, Sync to TTY
19:06:15.802| ### Couchbase Lite 1.1-Debug (unofficial) ###
2015-07-02 19:06:15.821 CBL Test[65252:737767] Opening database...
19:06:15.822| CBLDatabase: Created CBLManager[0x7ff8c867dbf0 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite]
19:06:15.873| CBLDatabase: CBLManager[0x7ff8c867dbf0 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite] is the sharedInstance
19:06:15.873| CBLDatabase: Opening CBLDatabase[<0x7ff8c84172b0>grocery-sync]
19:06:15.873| CBLDatabase: Using CBL_SQLiteStorage for db at 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite/grocery-sync.cblite
19:06:15.873| Couchbase Lite using SQLite version 3.8.5 (2014-08-15 22:37:57 
c8ade949d4a2eb3bba4702a4a0e17b405e9b6ace)
19:06:15.873| FYI, couldn't enable SQLite mmap
19:06:15.873| CBLDatabase: Opening <CBL_SQLiteStorage: 0x7ff8c8404df0>
19:06:15.873| CBLDatabase: Open 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite/grocery-sync.cblite (flags=6(null))
19:06:15.874| CBLDatabase: Begin transaction (level 1)...
19:06:15.874| CBLDatabase: <CBL_SQLiteStorage: 0x7ff8c8404df0>: Optimizing SQL 
indexes (curSeq=2, last run at 0)
19:06:15.876| CBLDatabase: Commit transaction (level 1)
2015-07-02 19:06:15.876 CBL Test[65252:737767] Application windows are expected 
to have a root view controller at the end of application launch
19:06:15.888| CBLDatabase: Created CBLManager[0x7ff8c86999f0 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite]
19:06:15.888| CBLDatabase: CBLManager[0x7ff8c867dbf0 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite] created CBL_Server[0x7ff8c8699c70] (with 
CBLManager[0x7ff8c86999f0 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite])
19:06:15.888‖ CBLDatabase: Opening CBLDatabase[<0x7ff8c840f500>grocery-sync]
19:06:15.889‖ CBLDatabase: Using CBL_SQLiteStorage for db at 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite/grocery-sync.cblite
19:06:15.889‖ CBLDatabase: Opening <CBL_SQLiteStorage: 0x7ff8c841f250>
19:06:15.889‖ CBLDatabase: Open 
/Users/rustam/Library/Developer/CoreSimulator/Devices/BD8E15D2-A708-4776-BF8F-0DAC24AEBF9E/data/Containers/Data/Application/CBBD5E0A-43B2-404C-96C6-14397AFC5A97/Library/Application
 Support/CouchbaseLite/grocery-sync.cblite (flags=6(null))
19:06:15.890| Sync: CBLReplication[from http://localhost:5984/a]: offline, 
progress = 0 / 0, err: (null)
19:06:15.890‖ CBLDatabase: Begin transaction (level 1)...
19:06:15.890| Sync: CBLReplication[to http://localhost:5984/a]: offline, 
progress = 0 / 0, err: (null)
19:06:15.890‖ CBLDatabase: Commit transaction (level 1)
19:06:15.890‖ Sync: CBL_Puller[http://localhost:5984/a] STARTING ...
19:06:15.894‖ Sync: CBL_Puller[http://localhost:5984/a]: Reachability state = 
<localhost>:unreachable (00), suspended=0
19:06:15.894‖ Sync: CBL_Pusher[http://localhost:5984/a] STARTING ...
19:06:15.895‖ Sync: CBL_Pusher[http://localhost:5984/a]: Reachability state = 
<localhost>:reachable (10002), suspended=0
19:06:15.895‖ Sync: CBL_Pusher[http://localhost:5984/a]: Going online
19:06:15.896‖ Sync: CBL_Pusher[http://localhost:5984/a] Progress: set active = 1
19:06:15.896‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/2de48914ae44665b60d6f2dd0c71d168e7e5b615]: 
Starting...
19:06:15.899‖ Sync: CBL_Puller[http://localhost:5984/a]: Reachability state = 
<localhost>:reachable (10002), suspended=0
19:06:15.899‖ Sync: CBL_Puller[http://localhost:5984/a]: Going online
19:06:15.899‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: set active = 1
19:06:15.899‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/78c8674b13af0a50f5c83ce31039f1cc504bd17a]: 
Starting...
19:06:15.904‖ Sync: CBL_Puller[http://localhost:5984/a] STOPPING...
19:06:15.904‖ Sync: Stopping 1 remote requests
19:06:15.904‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/78c8674b13af0a50f5c83ce31039f1cc504bd17a]: 
Stopped
19:06:15.905‖ Sync: CBL_Puller[http://localhost:5984/a]: Error fetching last 
sequence: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
19:06:15.905‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: set active = 0
19:06:15.905‖ Sync: CBL_Puller[http://localhost:5984/a] STOPPED
19:06:15.905‖ Replication: CBL_Puller[http://localhost:5984/a] took 0.013 sec; 
error=(null)
19:06:15.906‖ Sync: CBL_Pusher[http://localhost:5984/a] STOPPING...
19:06:15.906‖ Sync: Stopping 1 remote requests
19:06:15.906‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/2de48914ae44665b60d6f2dd0c71d168e7e5b615]: 
Stopped
19:06:15.906‖ Sync: CBL_Pusher[http://localhost:5984/a]: Error fetching last 
sequence: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
19:06:15.906‖ Sync: CBL_Pusher[http://localhost:5984/a] Progress: set active = 0
19:06:15.906‖ Sync: CBL_Pusher[http://localhost:5984/a] STOPPED
19:06:15.906‖ Replication: CBL_Pusher[http://localhost:5984/a] took 0.011 sec; 
error=(null)
19:06:15.906| Sync: CBLReplication[from http://localhost:5984/a]: offline, 
progress = 0 / 0, err: (null)
19:06:15.906‖ Sync: CBL_Puller[http://localhost:5984/a] STARTING ...
19:06:15.906| Sync: CBLReplication[to http://localhost:5984/a]: offline, 
progress = 0 / 0, err: (null)
19:06:15.906| CBLDatabase: PUT _id=my_doc_id, _rev=(null), _deleted=0, 
allowConflict=0
19:06:15.906| CBLDatabase: Begin transaction (level 1)...
19:06:15.907| CBLDatabase: Abort transaction (level 1)
2015-07-02 19:06:15.906 CBL Test[65252:737767] rev = (null)
2015-07-02 19:06:15.906 CBL Test[65252:737767] (null)
19:06:15.907‖ Sync: CBL_Puller[http://localhost:5984/a]: Reachability state = 
<localhost>:unreachable (00), suspended=0
19:06:15.908‖ Sync: CBL_Pusher[http://localhost:5984/a] STOPPING...
19:06:15.908‖ Sync: CBL_Puller[http://localhost:5984/a]: Reachability state = 
<localhost>:reachable (10002), suspended=0
19:06:15.908‖ Sync: CBL_Puller[http://localhost:5984/a]: Going online
19:06:15.908‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: set active = 1
19:06:15.908‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/78c8674b13af0a50f5c83ce31039f1cc504bd17a]: 
Starting...
19:06:15.908‖ Sync: CBL_Pusher[http://localhost:5984/a] STARTING ...
19:06:15.909‖ Sync: CBL_Pusher[http://localhost:5984/a]: Reachability state = 
<localhost>:reachable (10002), suspended=0
19:06:15.909‖ Sync: CBL_Pusher[http://localhost:5984/a]: Going online
19:06:15.910‖ Sync: CBL_Pusher[http://localhost:5984/a] Progress: set active = 1
19:06:15.910‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/2de48914ae44665b60d6f2dd0c71d168e7e5b615]: 
Starting...
19:06:15.915‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/2de48914ae44665b60d6f2dd0c71d168e7e5b615]: Got 
response, status 200
19:06:15.916‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/2de48914ae44665b60d6f2dd0c71d168e7e5b615]: 
Finished loading
19:06:15.916‖ Sync: CBL_Pusher[http://localhost:5984/a]: Replicating from 
lastSequence=2
19:06:15.916‖ Sync: CBL_Pusher[http://localhost:5984/a] Progress: set active = 0
19:06:15.916‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/78c8674b13af0a50f5c83ce31039f1cc504bd17a]: Got 
response, status 200
19:06:15.917‖ RemoteRequest: CBLRemoteJSONRequest[GET 
http://localhost:5984/a/_local/78c8674b13af0a50f5c83ce31039f1cc504bd17a]: 
Finished loading
19:06:15.917‖ Sync: CBL_Puller[http://localhost:5984/a]: Replicating from 
lastSequence=1
19:06:15.956‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: 
Starting...
19:06:15.958‖ ChangeTracker: Changes feed using proxy settings {
    ExceptionsList =     (
        "*.local",
        "169.254/16"
    );
    FTPPassive = 1;
    "__SCOPED__" =     {
        en1 =         {
            ExceptionsList =             (
                "*.local",
                "169.254/16"
            );
            FTPPassive = 1;
        };
    };
}
19:06:15.958‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: 
Started... 
<http://localhost:5984/a/_changes?feed=normal&heartbeat=300000&style=all_docs&since=1>
19:06:15.958‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: Event 1 
on <__NSCFInputStream: 0x7ff8c8782b50>
19:06:15.962‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: 
EndEncountered <__NSCFInputStream: 0x7ff8c8782b50>
19:06:15.962‖ Sync: CBL_Puller[http://localhost:5984/a]: Caught up with changes!
19:06:15.962‖ Sync: CBL_Puller[http://localhost:5984/a] queued 1 remote 
revisions from seq=3 (0 in bulk, 1 individually)
19:06:15.973| Sync: CBLReplication[to http://localhost:5984/a]: active, 
progress = 0 / 0, err: (null)
19:06:15.976| Sync: CBLReplication[from http://localhost:5984/a]: active, 
progress = 0 / 0, err: (null)
19:06:15.976| Sync: CBLReplication[from http://localhost:5984/a]: stopped, 
progress = 0 / 0, err: (null)
19:06:15.976| Sync: CBLReplication[to http://localhost:5984/a]: stopped, 
progress = 0 / 0, err: (null)
19:06:15.976| Sync: CBLReplication[from http://localhost:5984/a]: active, 
progress = 0 / 0, err: (null)
2015-07-02 19:06:15.976 CBL Test[65252:737767] SYNC progress: 0 / 0
19:06:15.978| Sync: CBLReplication[to http://localhost:5984/a]: active, 
progress = 0 / 0, err: (null)
2015-07-02 19:06:15.978 CBL Test[65252:737767] SYNC progress: 0 / 0
19:06:15.978| Sync: CBLReplication[to http://localhost:5984/a]: idle, progress 
= 0 / 0, err: (null)
2015-07-02 19:06:15.978 CBL Test[65252:737767] SYNC progress: 0 / 0
19:06:15.978| Sync: CBLReplication[from http://localhost:5984/a]: active, 
progress = 0 / 1, err: (null)
2015-07-02 19:06:15.978 CBL Test[65252:737767] SYNC progress: 0 / 1
19:06:15.980‖ RemoteRequest: CBLMultipartDownloader[/a/my_doc_id]: Starting...
19:06:15.980‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: 
Starting...
19:06:15.981‖ ChangeTracker: Changes feed using proxy settings {
    ExceptionsList =     (
        "*.local",
        "169.254/16"
    );
    FTPPassive = 1;
    "__SCOPED__" =     {
        en1 =         {
            ExceptionsList =             (
                "*.local",
                "169.254/16"
            );
            FTPPassive = 1;
        };
    };
}
19:06:15.981‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: 
Started... 
<http://localhost:5984/a/_changes?feed=longpoll&heartbeat=300000&style=all_docs&since=3>
19:06:15.981‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: Event 1 
on <__NSCFInputStream: 0x7ff8c877eea0>
19:06:15.986‖ RemoteRequest: CBLMultipartDownloader[/a/my_doc_id]: Got 
response, status 200
19:06:15.986‖ CBLDatabase: Begin transaction (level 1)...
19:06:15.987‖ WARNING: CBL_Puller[http://localhost:5984/a] failed to write 
{my_doc_id #4-a0716cf34b240d1dec1ef7ada408063e}: status=491
19:06:15.987‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: set error = 
400 Invalid attachment
19:06:15.987‖ Sync: CBL_Puller[http://localhost:5984/a] STOPPING...
19:06:15.987‖ ChangeTracker: CBLSocketChangeTracker[0x7ff8c872d120 a]: stop
19:06:15.987‖ Sync: Stopping 0 remote requests
19:06:15.988‖ CBLDatabase: Commit transaction (level 1)
19:06:15.988‖ Sync: CBL_Puller[http://localhost:5984/a] inserted 1 revs in 
0.002 sec (576.0/sec)
19:06:15.988‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: set active = 0
19:06:15.989‖ Sync: CBL_Puller[http://localhost:5984/a] STOPPED
19:06:15.989‖ Replication: CBL_Puller[http://localhost:5984/a] took 0.082 sec; 
error=Error Domain=CBLHTTP Code=400 "400 Invalid attachment" 
UserInfo=0x7ff8c843d130 {NSLocalizedFailureReason=Invalid attachment, 
NSLocalizedDescription=400 Invalid attachment}
19:06:15.989‖ Sync: CBL_Puller[http://localhost:5984/a] Progress: 1 / 1
19:06:16.078| Sync: CBLReplication[from http://localhost:5984/a]: stopped, 
progress = 1 / 1, err: 400 Invalid attachment

Reply via email to