[SERVER-8226] C++ driver fassert 16464 when runGlobalInitializersOrDie is not called Created: 18/Jan/13 Updated: 11/Jul/16 Resolved: 01/Feb/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | 2.4.0-rc1 |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Pieter Willem Jordaan | Assignee: | Randolph Tan |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux 3.5.0-21-generic x86_64 |
||
| Issue Links: |
|
||||||||||||||||
| Operating System: | Linux | ||||||||||||||||
| Steps To Reproduce: | Any C++ program with the above version which calls a find will reproduce this assert |
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Trying any find command when a replica set only contains a primary (only one server in the set) an fassert 16464 is raised in _isQueryOkToSecondary. It must be noted that I am using a ScopedDbConnection. |
| Comments |
| Comment by Pieter Willem Jordaan [ 01/Feb/13 ] |
|
Randolph thank you I appreciate it! |
| Comment by Randolph Tan [ 01/Feb/13 ] |
|
climax: We changed the client driver so the user doesn't need to call runGlobalInitializersOrDie. |
| Comment by auto [ 01/Feb/13 ] |
|
Author: {u'date': u'2013-01-31T21:19:28Z', u'email': u'randolph@10gen.com', u'name': u'Randolph Tan'}Message: Changed implementation to not rely on the global initialization framework. |
| Comment by Pieter Willem Jordaan [ 18/Jan/13 ] |
|
Thanks for clarifying. You make an excellent point. |
| Comment by Randolph Tan [ 18/Jan/13 ] |
|
The main use for runGlobalInitializersOrDie is for initializing all static variables while maintaining the right order (for example, if one variable depends on another to be initialized first). This also makes the initialization more simple because we don't need to worry about protecting the data structure with mutex (which can create unnecessary points of serialization) even though we need to modify it only once in the program life time. |
| Comment by Pieter Willem Jordaan [ 18/Jan/13 ] |
|
This seems rather sloppy. Can't the main db connection classes ensure that static variables get initialized during first call? Same with cleaning up at the end of the program (mongo::dbexit(mongo::EXIT_CLEAN) |
| Comment by Randolph Tan [ 18/Jan/13 ] |
|
Hi, You need to call runGlobalInitializersOrDie near the start of your program. This method is used for initializing static variables used by Mongo. |