[SERVER-17027] Inserts that create a collection can segfault if there is an ill-timed WriteConflictException Created: 23/Jan/15  Updated: 18/Sep/15  Resolved: 26/Jan/15

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.8.0-rc5
Fix Version/s: 3.0.0-rc7

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

Issue Links:
Duplicate
is duplicated by SERVER-17045 SEGFAULT in WriteBatchExecutor Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

The below stack trace occurs, indicating that collection creation failed but the "state lock" in the write command insert state object was only partially released.

#1  0x000000000118596e in mongo::StringData::StringData (this=0x7ffff7ecd8e0, s=...) at src/mongo/base/string_data.h:77
#2  0x000000000135da37 in mongo::singleInsert (txn=0x7ffff7ed0790, docToInsert=..., collection=0x0, result=0x7ffff7ecd9d0)
    at src/mongo/db/commands/write_commands/batch_executor.cpp:1133
#3  0x000000000135d4c1 in mongo::insertOne (state=0x7ffff7ecee60, result=0x7ffff7ecd9d0) at src/mongo/db/commands/write_commands/batch_executor.cpp:1068
#4  0x000000000135d8b5 in mongo::WriteBatchExecutor::execOneInsert (this=0x7ffff7ecf270, state=0x7ffff7ecee60, error=0x7ffff7ecee38)
    at src/mongo/db/commands/write_commands/batch_executor.cpp:1108
#5  0x000000000135c08c in mongo::WriteBatchExecutor::execInserts (this=0x7ffff7ecf270, request=..., errors=0x7ffff7ecf0f0)
    at src/mongo/db/commands/write_commands/batch_executor.cpp:882
#6  0x000000000135bac9 in mongo::WriteBatchExecutor::bulkExecute (this=0x7ffff7ecf270, request=..., upsertedIds=0x7ffff7ecf110, errors=0x7ffff7ecf0f0)
    at src/mongo/db/commands/write_commands/batch_executor.cpp:764
#7  0x000000000135980f in mongo::WriteBatchExecutor::executeBatch (this=0x7ffff7ecf270, request=..., response=0x7ffff7ecf2b0)
    at src/mongo/db/commands/write_commands/batch_executor.cpp:272
#8  0x0000000001363b16 in mongo::WriteCmd::run (this=0x7ffff62a66e0, txn=0x7ffff7ed0790, dbName=..., cmdObj=..., options=0, errMsg=..., result=..., fromRepl=false)
    at src/mongo/db/commands/write_commands/write_commands.cpp:147
#9  0x0000000001383763 in mongo::_execCommand (txn=0x7ffff7ed0790, c=0x7ffff62a66e0, dbname=..., cmdObj=..., queryOptions=0, errmsg=..., result=..., fromRepl=false)
    at src/mongo/db/dbcommands.cpp:1267



 Comments   
Comment by Githook User [ 26/Jan/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17027 Properly clean up WriteBatchExecutor::ExecInsertsState on WriteConflictException.

(cherry picked from commit 2cc831c713e0f68a41dbf2a9024e0de948b37a6f)
Branch: v3.0
https://github.com/mongodb/mongo/commit/31c67d70ba53a0a3637934bbf180a1810763270e

Comment by Githook User [ 23/Jan/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17027 Properly clean up WriteBatchExecutor::ExecInsertsState on WriteConflictException.
Branch: master
https://github.com/mongodb/mongo/commit/2cc831c713e0f68a41dbf2a9024e0de948b37a6f

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