tej shah
tej shah

Reputation: 3095

Issue in PreparedAttachment in Cloudant

Last 2 or 3 days i am getting issue in attachment download when app are sync first time with cloudant.

Error log is:-

W/PreparedAttachment: Problem reading from input or writing to output stream java.net.ProtocolException: unexpected end of stream 
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:449)

at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
at java.io.InputStream.read(InputStream.java:162)
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:83)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213)
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037)
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136)
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386)
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252)
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177)
at java.lang.Thread.run(Thread.java:818)

E/PullStrategy: There was a problem downloading an attachment to the datastore, terminating replication
com.cloudant.sync.datastore.AttachmentNotSavedException: java.net.ProtocolException: unexpected end of stream
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:90)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213)
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037)
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136)
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386)
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252)
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.net.ProtocolException: unexpected end of stream
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:449)
at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
at java.io.InputStream.read(InputStream.java:162)
at com.cloudant.sync.datastore.PreparedAttachment.<init>(PreparedAttachment.java:83)
at com.cloudant.sync.datastore.AttachmentManager.prepareAttachment(AttachmentManager.java:213) 
at com.cloudant.sync.datastore.DatastoreImpl.prepareAttachment(DatastoreImpl.java:1037) 
at com.cloudant.sync.replication.DatastoreWrapper.prepareAttachment(DatastoreWrapper.java:136) 
at com.cloudant.sync.replication.PullStrategy.processOneChangesBatch(PullStrategy.java:386) 
at com.cloudant.sync.replication.PullStrategy.replicate(PullStrategy.java:252) 
at com.cloudant.sync.replication.PullStrategy.run(PullStrategy.java:177) 
at java.lang.Thread.run(Thread.java:818) 

please give me your help. thank you.

Upvotes: 0

Views: 157

Answers (1)

rhyshort
rhyshort

Reputation: 1453

The problem isn't with PreparedAttachment its with the underlying networking. It would appear that server sent more bytes than then Content-Length header stipulated. This is probably a bug with the server you using.

Upvotes: 2

Related Questions