[SERVER-6222] Mongo crashes if query for collection in new db Created: 27/Jun/12  Updated: 11/Jul/16  Resolved: 02/Jul/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.1.2
Fix Version/s: 2.2.0-rc0

Type: Bug Priority: Blocker - P1
Reporter: David O'Hara Assignee: Ben Becker
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win2008, Win7


Attachments: Text File mongo.log     File run-mongod.bat     File run-mongod.bat    
Issue Links:
Duplicate
is duplicated by SERVER-3744 --profile should create system.profil... Closed
Operating System: ALL
Participants:

 Description   

A new db is used and a query is executed against it causing the mongod process to crash.

Step to repro:

1. Initiate mongo console to mongod
2. Type "use foo" where "foo" is a new database name (never used before)
3. Type "db.Bar.find()"
4. Watch process die horribly...

NOTE: I made sure to clear out all data files to be sure I wasn't using a previously existant db.



 Comments   
Comment by Ben Becker [ 02/Jul/12 ]

Solution was to enforce collection creation in the call to profile().

Comment by auto [ 02/Jul/12 ]

Author:

{u'date': u'2012-07-02T12:16:04-07:00', u'email': u'ben.becker@10gen.com', u'name': u'Ben Becker'}

Message: SERVER-6222: lazy init profile collection
Branch: master
https://github.com/mongodb/mongo/commit/1d58eed0e23bb446388205a1df7f3eebef1f29a2

Comment by David O'Hara [ 27/Jun/12 ]

Awesome, I suppose if I yank that part, I can move forward. Many thanks for the quick responses.

Comment by Ben Becker [ 27/Jun/12 ]

This issue can be reproduced on any OS by simply starting mongod with --profile=2 and running the supplied commands ('use foo', then 'db.bar.find()') on a namespace that does not exist.

Comment by Ben Becker [ 27/Jun/12 ]

Hi Dave,

Many thanks for the update. I'm able to reproduce this now – this actually appears to be caused by enabling the profiler with an empty DB. Digging into this a bit further now, but if you need a quick work-around you can remove the --profile=2 line from startup and wait until the collection has been created.

Regards,
Ben

Comment by David O'Hara [ 27/Jun/12 ]

Ben,

I appreciate the quick replies & look.

1. Yes, I can repro 100% of the time.
2. It was the 2008+ version
3. Starting in a shell (from a bat file)
4. c:\develop\<project name>\lib\mongodb\bin is the location for mongod.exe
5. It is on the c: (same as mongod) and it is an NTFS volume.

I've attached the run-mongo.bat file so you can see how I'm starting the process. Otherwise, the procedure is spot on to what I've described. One thing that can make a little difference, be sure to completely clear out the data/ozsystems dir before starting mongod. Then you can be sure that executing the query is against an empty dataset.

Thanks,
Dave

Comment by Ben Becker [ 27/Jun/12 ]

Hi David,

I'm trying to reproduce this locally with Win7 Ultimate w/ SP1 and all of the latest OS updates, but haven't had any luck yet. I have a few questions about reproducing this:

  1. Does this happen every time?
  2. Did you download the standard v2.1.2 distribution, or the '2008+' version?
  3. How are you starting the mongod.exe process (e.g. as a service, in a shell, batch script, etc.)?
  4. What drive and directory is the mongod.exe binary in?
  5. Is the 'data\ozsystems' directory on an NTFS volume? Is this on the same drive as mongod.exe?

Any additional details about the host system would be greatly appreciated.

Thanks,
Ben

Comment by Tad Marshall [ 27/Jun/12 ]

Can you post the mongod log for the crash?

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