[JAVA-2957] Prematurely reached end of stream Created: 03/Sep/18  Updated: 27/Oct/23  Resolved: 07/Sep/18

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Yogesh VR Assignee: Ross Lawley
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File server-log.txt     Text File stacktrace.txt    

 Description   

We are getting the error "com.mongodb.MongoSocketReadException: Prematurely reached end of stream" even for simple find/update queries that would normally take few milliseconds.

Can you please let us know if some kind of connection config on either server or driver would resolve this ?

Mongodb version: 3.6.6
Mongodb java driver version: 3.6.4



 Comments   
Comment by Pradeep Ghanto [ 30/Jul/21 ]

Ross Lawley,

Could you please elaborate on the fix for this issue here? (com.mongodb.MongoSocketReadException: Prematurely reached end of stream)

Comment by Yogesh VR [ 07/Sep/18 ]

Hi Ross Lawley,

Thanks, we had a deployment at the error timestamp, I think this confirms your hypothesis.

Yogesh VR

Comment by Ross Lawley [ 07/Sep/18 ]

Hi yogeshvr,

Looking at the logs, my hypothesis is the server was shutdown and as the Mongo Java Driver was reading from the server at the time, it couldn't read the expected data and threw the Prematurely reached end of stream error.

I hope that helps,

Ross

Comment by Yogesh VR [ 03/Sep/18 ]

Hi Ross Lawley,
Please find the attached server log and stacktrace.
server-log.txt stacktrace.txt

Comment by Ross Lawley [ 03/Sep/18 ]

Hi yogeshvr,

This error occurs when the driver fails to read data from the InputStream when its expected to be there. Providing more information either the full stacktrace or reviewing the server logs for the cause should provide more insight.

Kind Regards,

Ross

Generated at Thu Feb 08 08:58:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.