[SERVER-4584] mongod crashes when trying to create a collection in a database * Created: 29/Dec/11  Updated: 11/Jul/16  Resolved: 24/Jan/12

Status: Closed
Project: Core Server
Component/s: Stability
Affects Version/s: 2.0.2
Fix Version/s: 2.1.0

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

Windows 7 x64 mongod 64 bit windows 2.0.2


Issue Links:
Duplicate
is duplicated by SERVER-4122 Validate database and collection name... Closed
is duplicated by SERVER-6057 can't remove ill formed database Closed
Related
related to SERVER-6729 restrict database names only on Windo... Closed
related to SERVER-9309 Database name restrictions should be ... Closed
Operating System: ALL
Participants:

 Description   

Start mongod, and the following when run from the shell crashes mongod.

db2 = db.getSiblingDB("*")
db2.createCollection("foo")

The following is from the mongod log
Thu Dec 29 15:16:40 [conn1] Create/OpenFile failed /data/db/*.ns errno:123
Thu Dec 29 15:16:40 [conn1] error couldn't open file /data/db/*.ns terminating
Thu Dec 29 15:16:40 dbexit:
Thu Dec 29 15:16:40 [conn1] shutdown: going to close listening sockets...
Thu Dec 29 15:16:40 [conn1] closing listening socket: 388
Thu Dec 29 15:16:40 [conn1] closing listening socket: 404
Thu Dec 29 15:16:40 [conn1] shutdown: going to flush diaglog...



 Comments   
Comment by Eric Milkie [ 24/Jan/12 ]

Release notes for 2.2 have been added to the wiki.

Comment by auto [ 06/Jan/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-4584 add to illegal dbname characters list

These newly added characters are illegal for Windows filenames (although it is possible to create files
with such names on NTFS, the API to access these files will prohibit them unless you do something special).
We are prohibiting these same characters on Linux because they're a bad idea to use.
Upgrading a database with a name containing illegal characters will cause the new mongod to fail to start.
Branch: master
https://github.com/mongodb/mongo/commit/413a07d12c4a318c7be92af9625b595a95f92942

Comment by Eliot Horowitz (Inactive) [ 06/Jan/12 ]

We should add a note to the release notes about how to move data if you happened to have a database with one of those characters.

Comment by Eliot Horowitz (Inactive) [ 06/Jan/12 ]

Those should all be illegal.

Comment by Eric Milkie [ 05/Jan/12 ]

I have a change pending that adds

*<>|:

to the list of illegal dbname characters. These characters are all illegal on Windows, and are ill-advisable on Linux.
This means if someone already has a database name with those characters (on Linux), once they upgrade to 2.1.0+, mongod will refuse to start.
This sounds unlikely to happen. Is it okay to commit this?

Comment by Sridhar Nanjundeswaran [ 05/Jan/12 ]

It still crashed on Windows 7 with the same error for me with the latest commit 45ab7c3a4d9cbe199539464e966ad4193963f6fc.

Comment by Eric Milkie [ 05/Jan/12 ]

Do we want to prohibit unwise but legal-on-some-OS's names like "*"? I think we should.
However, this might break those users attempting to use UTF-8 names.
So I think I will instead just validate that a database name can be stored in a filename on the local filesystem. This will prevent server crashes. If you want to make a database named * and that's a legal filename on your filesystem, then go right ahead.

Another reproducer for this:

use *
db.createCollection('oops')

Comment by Eric Milkie [ 05/Jan/12 ]

Even worse, when I tried it just now with HEAD of master, it actually successfully creates database files with *'s:

-rw-------. 1 milkie wheel  131072 2012-01-05 13:08 *.0
-rw-------. 1 milkie wheel  262144 2012-01-05 13:08 *.1
-rw-------. 1 milkie wheel   32768 2012-01-05 13:08 *.ns

Comment by Eliot Horowitz (Inactive) [ 05/Jan/12 ]

Not sure actually...

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