[SERVER-12337] mongoshell client crashes in windows when running bad command Created: 13/Jan/14  Updated: 26/Aug/15  Resolved: 23/Jul/15

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.4.8, 2.6.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: MICHAEL PERMANA Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 8 64-bit


Issue Links:
Duplicate
is duplicated by SERVER-14332 Incorrect parameter to db.serverStatu... Closed
Backwards Compatibility: Fully Compatible
Operating System: Windows
Steps To Reproduce:

run this command , purposedly dont have the collection and field, it'll say invalid syntax, and crash:

K:\thirdparty\mongodb-win32-x86_64-2008plus-2.4.8\bin>mongo 192.168.0.100
MongoDB shell version: 2.4.8
connecting to: 192.168.0.100/test
> use crash
switched to db crash
> db.receipts.runCommand('distinct', 'accountPayment')

Participants:

 Description   

Just run mongo shell in windows, this build. Can use any empty database, bellow I just use 'crash'. Then runCommand on some collection, and it'll crash the shell:

K:\thirdparty\mongodb-win32-x86_64-2008plus-2.4.8\bin>mongo 192.168.0.100
MongoDB shell version: 2.4.8
connecting to: 192.168.0.100/test
> use crash
switched to db crash
> db.receipts.runCommand('distinct', 'accountPayment')
Sun Jan 12 18:58:06.087 SyntaxError: Unexpected identifier



 Comments   
Comment by Mark Benvenuto [ 28/Jul/15 ]

This no longer reproduces in 3.0.x and later releases.

Comment by Carl Brenton [ 03/Sep/14 ]

I have had this error when importing a javascript file when working on the M101 course (I running v2.6.3 on windows).
The default db is test but even though the db is specified on the command line the "use agg" command causes the error:

simple_aggregation_example>mongo localhost:27017/agg products.js
MongoDB shell version: 2.6.3
connecting to: localhost:27017/agg
2014-09-02T19:04:35.481+0100 SyntaxError: Unexpected identifier at products.js:2

If I comment out the line in the js then it runs without error.
If I use the dos redirect it runs without error.

Interestingly there's also some inconsistency between mongo.exe and mongoimport.exe. I believe mongoimport does not exibit this issue. Also if you compare the help output for both you'll find there's a difference as far as help text is copncerned.
Mongoimport help describes the redirect character whereas in reality I don't think one is needed. This inconsistency could do with some attention.

Comment by Ramon Fernandez Marina [ 23/Jun/14 ]

mpermana, we are able to reproduce the shell crash and we are investigating.

Comment by Ramon Fernandez Marina [ 20/Jun/14 ]

Hi mpermana, is this still an issue for you? Are there any other messages after the "SyntaxError"? Or does the shell terminate?

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