[SERVER-27460] RouterStageMerge::kill() can crash during mongos shutdown Created: 19/Dec/16  Updated: 05/Apr/17  Resolved: 18/Jan/17

Status: Closed
Project: Core Server
Component/s: Querying, Sharding
Affects Version/s: 3.2.11, 3.4.0
Fix Version/s: 3.2.13, 3.4.2, 3.5.2

Type: Bug Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-25497 Fix sharded query path to handle shut... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2
Sprint: Query 2017-01-23
Participants:

 Description   

RouterStageMerge::kill() retrieves an Event which will be signaled when the mongos cursor is safe to destroy. However, this Event will be invalid if it is retrieved while mongos is shutting down, as documented here:

https://github.com/mongodb/mongo/blob/r3.5.1/src/mongo/s/query/async_results_merger.h#L170

This case is not handled correctly by RouterStageMerge::kill(), since it can wait on an invalid event, resulting in an invariant being triggered. Fixing RouterStageMerge::kill() to not wait on an invalid event is a partial fix for SERVER-25497, which describes the more general problem of the mongos query path not being synchronized with the process's shutdown sequence.



 Comments   
Comment by Githook User [ 02/Feb/17 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27460 fix RouterStageMerge::kill() crash during mongos shutdown

(cherry picked from commit c43d7cd31af6854eaf134f8021d9f0784ddf5070)

Conflicts:
src/mongo/s/query/async_results_merger.cpp
src/mongo/s/query/async_results_merger_test.cpp
Branch: v3.2
https://github.com/mongodb/mongo/commit/3533501da0803d9d7d4fa169f9f3bc5af7cd4a52

Comment by Githook User [ 23/Jan/17 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27460 fix RouterStageMerge::kill() crash during mongos shutdown

(cherry picked from commit c43d7cd31af6854eaf134f8021d9f0784ddf5070)
Branch: v3.4
https://github.com/mongodb/mongo/commit/cf7c424372c733f572831c42f3a5810bef45543e

Comment by Githook User [ 18/Jan/17 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27460 fix RouterStageMerge::kill() crash during mongos shutdown
Branch: master
https://github.com/mongodb/mongo/commit/c43d7cd31af6854eaf134f8021d9f0784ddf5070

Generated at Thu Feb 08 04:15:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.