[CDRIVER-199] Socket reads not checked for IO errors, e.g. timeouts Created: 28/Feb/13 Updated: 19/Oct/16 Resolved: 01/Mar/13 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.7 |
| Fix Version/s: | 0.8.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Gary Murakami | Assignee: | Gary Murakami |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
mongo.c:315 in mongo_read_response mongo_env_read_socket( conn, &head, sizeof( head ) ); These socket read ops are not checked for an error, e.g., timeout. The function ignores the error, will probably be out-of-sync, and will carry on with garbage. The read ops should be checked and appropriate action taken, probably closing the socket since message will be out-of-sync and the socket no longer useful. |
| Comments |
| Comment by Gary Murakami [ 01/Mar/13 ] |
|
Note that the current C driver code is (highly) inefficient in terms of system call socket reads - mongo_read_response takes three socket recv calls to do what should be done more optimally with one recv. The mongo_read_response function should be revisited to at least reduce the above two reads to one. Any future rewrite should pay careful attention to system calls and mallocs. |
| Comment by auto [ 01/Mar/13 ] |
|
Author: {u'date': u'2013-03-01T06:23:51Z', u'name': u'Gary Murakami', u'email': u'gary.murakami@10gen.com'}Message: check all socket reads and return value on error
|