[CDRIVER-843] WSASend incorrect error checking Created: 15/Sep/15  Updated: 19/Oct/16  Resolved: 28/Sep/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.1.10
Fix Version/s: 1.2-rc0, 1.1.11

Type: Bug Priority: Blocker - P1
Reporter: Hannes Magnusson Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to CDRIVER-756 Unchecked errors on failed network wr... Closed

 Description   

On Windows we use WSASend() to send iovecs.

There is a lot of type mangling going on there for the error check and eventual return type of mongoc_socket_try_sendv().

This needs to be updated to use clean types and explicit error checking.

We also need to check the result for SOCKET_ERROR as per the docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ms742203%28v=vs.85%29.aspx



 Comments   
Comment by Githook User [ 11/Jan/16 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()

Conflicts:
src/mongoc/mongoc-socket-private.h
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/04df2203cba59e7886e019de690715526a063d9e

Comment by Githook User [ 11/Jan/16 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0

Conflicts:
src/mongoc/mongoc-socket.c
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/63f3d5a83a2af17d18a58da554f4e299197a99c0

Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}

Message: Merge pull request #267 from bjori/master

CDRIVER-843 & friends
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/5249890d1804d6da252ba7d45286591c1242106d

Comment by Githook User [ 11/Jan/16 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/b24d1d258bf0967fa80d2093f12fe37c20b5d844

Comment by Githook User [ 11/Jan/16 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/4b32898894848b8ad2121743f0145f1e29dfd473

Comment by Githook User [ 26/Oct/15 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()

Conflicts:
src/mongoc/mongoc-socket-private.h
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/04df2203cba59e7886e019de690715526a063d9e

Comment by Githook User [ 26/Oct/15 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0

Conflicts:
src/mongoc/mongoc-socket.c
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/63f3d5a83a2af17d18a58da554f4e299197a99c0

Comment by Githook User [ 26/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}

Message: Merge pull request #267 from bjori/master

CDRIVER-843 & friends
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/5249890d1804d6da252ba7d45286591c1242106d

Comment by Githook User [ 26/Oct/15 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/b24d1d258bf0967fa80d2093f12fe37c20b5d844

Comment by Githook User [ 26/Oct/15 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/4b32898894848b8ad2121743f0145f1e29dfd473

Comment by Githook User [ 28/Sep/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}

Message: Merge pull request #267 from bjori/master

CDRIVER-843 & friends
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/5249890d1804d6da252ba7d45286591c1242106d

Comment by Githook User [ 28/Sep/15 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/b24d1d258bf0967fa80d2093f12fe37c20b5d844

Comment by Githook User [ 28/Sep/15 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/4b32898894848b8ad2121743f0145f1e29dfd473

Comment by Githook User [ 16/Sep/15 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()

Conflicts:
src/mongoc/mongoc-socket-private.h
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/04df2203cba59e7886e019de690715526a063d9e

Comment by Githook User [ 16/Sep/15 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0

Conflicts:
src/mongoc/mongoc-socket.c
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/63f3d5a83a2af17d18a58da554f4e299197a99c0

Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}

Message: Merge pull request #267 from bjori/master

CDRIVER-843 & friends
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5249890d1804d6da252ba7d45286591c1242106d

Comment by Githook User [ 16/Sep/15 ]

Author:

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

Message: CDRIVER-843: Add a test for flooding sendv()
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b24d1d258bf0967fa80d2093f12fe37c20b5d844

Comment by Githook User [ 16/Sep/15 ]

Author:

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

Message: CDRIVER-843 & CDRIVER-756: Incorrect error checking

Use int for WSASend() and debug both return value and sent bytes
Also check the return value for SOCKET_ERROR, not !0
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/4b32898894848b8ad2121743f0145f1e29dfd473

Comment by Hannes Magnusson [ 16/Sep/15 ]

https://github.com/mongodb/mongo-c-driver/pull/267

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