[CDRIVER-480] stream: Failure to buffer 4 bytes: Failed to buffer 4 bytes within 300000 milliseconds Created: 09/Dec/14  Updated: 17/Aug/15  Resolved: 14/Jul/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.0.2
Fix Version/s: 1.2-beta0

Type: Bug Priority: Major - P3
Reporter: Allen K Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

centos4.3


Issue Links:
Duplicate
is duplicated by CDRIVER-682 mongoc_stream_check_closed not called? Closed

 Description   

hi,
when I use mongoc_collection_insert and mongoc_client_pool_try_pop to insert one record into mongodb, bson_error_t ::message was set to "Failed to read 4 bytes from socket". Even worse, I found out that thousands of same record were inserted into mongo, only the object_id was not the same.
how could this happen?
my mongo-c-client is 1.0.2, and my mongodb is 2.6.5.
thanks a lot .
Allen



 Comments   
Comment by Githook User [ 13/Jul/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-480: Check for closed sockets before sending things over the wire
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/f7cb8c497604a291780d6b0692732014bda20835

Comment by A. Jesse Jiryu Davis [ 19/Jun/15 ]

Needs forward-port to 1.2, CHECK_CLOSED_DURATION_MSEC isn't checked in the 1.2.0-dev branch.

Comment by Mira Carey [ 25/Feb/15 ]

Allen,

I'm going to close this as fixed (I was able to reproduce a problem somewhat similar to yours that I did fix in 1.1.0).

If you're still having trouble, please re-open or file a new issue.

Regards,
Jason

Comment by Mira Carey [ 19/Dec/14 ]

Allen,

I've taken some steps to improve handling of long running sockets in libmongoc (specifically, checking if the socket is half closed before attempting writes). The change was introduced in https://github.com/mongodb/mongo-c-driver/commit/08cbe7621a64847792da091693268846aaf283f5. There is still always the chance for a race (where we write a command onto the wire and then the server hangs up before giving us the result), but that change should remove the majority of spurious errors of that kind.

I'll be releasing a 1.1.0-rc1 in a few days that will include that change, if you could test against that and let me know if it fixes your problem I'd greatly appreciate it. Or feel free to test against current master, that also includes that change.

Regards,
Jason

Comment by Allen K [ 10/Dec/14 ]

hi,
I am sorry that I made a mistake. Duplicated insertion due to my environment problem. My program got data from a redis cluster with two instance, which is slave of each other.
But there is still problem. The mongoc api report insertion failure but in fact, data has been inserted into mongodb. The network between my mongo client and mongodb is in good condition, and I use connection pool. I still wonder how to solve this warning.
thanks again.
Allen

Generated at Wed Feb 07 21:09:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.