[SERVER-8388] scoped_db_conn_test threading issues Created: 29/Jan/13  Updated: 11/Jul/16  Resolved: 31/Jan/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: 2.4.0-rc0

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

while (build/linux2/normal/mongo/scoped_db_conn_test) do true; done

Participants:

 Description   

causing Nightly Linux 64 to sporadically fail.

If you run scoped_db_conn_test repeatedly in a while loop, it doesn't even run for a minute before it crashes on shutdown:

scoped_db_conn_test: src/third_party/boost/boost/thread/pthread/mutex.hpp:154: void boost::timed_mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.
Aborted (core dumped)



 Comments   
Comment by auto [ 31/Jan/13 ]

Author:

{u'date': u'2013-01-30T16:35:28Z', u'email': u'randolph@10gen.com', u'name': u'Randolph Tan'}

Message: SERVER-8388 scoped_db_conn_test threading issues

Made sure to wait for all listening threads to terminate before finishing one test case.
Branch: master
https://github.com/mongodb/mongo/commit/f8095df93efac80bc8d6ec994abff2d0e0419732

Comment by Randolph Tan [ 29/Jan/13 ]

Problem1:
There can be several handleIncomingMsg thread still running and when it tries to terminate, it can crash when calling (with error: pure virtual method called):

handler->disconnected( p.get() );

because the main thread already died and called the destructor for the file local variable dummyHandler.

Changing dummyHandler to become a heap variable seems to make this go away.

Problem2:
Assertion `!pthread_mutex_destroy(&m)' failed.

Likely related to Problem1 stacktraces show mutex desctructors being called from handleIncomingMsg.
Adding static ::mongo::StaticObserver StaticObserver; in unittest_main.cpp doesn't make this go away.

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