[CDRIVER-3587] Do not reuse server stream that becomes invalid on failure to end session Created: 23/Mar/20  Updated: 28/Oct/23  Resolved: 25/Mar/20

Status: Closed
Project: C Driver
Component/s: Bulk API, libmongoc
Affects Version/s: None
Fix Version/s: 1.17.0-beta, 1.17.0

Type: Bug Priority: Major - P3
Reporter: Roberto Sanchez Assignee: Roberto Sanchez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
clones CDRIVER-3306 Do not assume non-empty server reply ... Closed
Gantt Dependency
has to be done before CDRIVER-3305 OP_MSG unordered bulk writes should n... Closed
Related
related to CDRIVER-3239 Driver aborts during OP_MSG bulk writ... Closed

 Description   

A mongoc_server_stream_t should not be reused after calling mongoc_cluster_run_command_monitored on with the stream.

In two situations, the stream will disconnect and be invalidated:

  • a network error (example)
  • a "not master" or "node is recovering error" for pre 4.2 server (here)

When that happens, the server_stream for that operation is no longer valid. But we do not always account that correctly.

_mongoc_write_opmsg (incorrectly) always ends unordered bulk operations on error because of CDRIVER-3305. Once that is resolved, it will need to handle the case of an invalidated server stream.

_mongoc_write_opquery only sets must_stop to true for what it deems is a network error (of which, that check might not be quite right if error labels were applied). But it does not handle the case of a "not master" or "node is recovering" error causing a disconnect.



 Comments   
Comment by Githook User [ 31/Mar/20 ]

Author:

{'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com', 'username': 'rcsanchez97'}

Message: CDRIVER-3587 use centralized check for valid stream
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b9577cb172d31dc58095dc1b151a94096a87db24

Comment by Githook User [ 25/Mar/20 ]

Author:

{'name': 'Roberto C. Sánchez', 'username': 'rcsanchez97', 'email': 'roberto@connexer.com'}

Message: CDRIVER-3587 do not reuse invalid server stream
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f89afb0d9bc717b4267464912e2dfe67af8db095

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