[SERVER-7616] Assertion error in mongo shell Created: 11/Nov/12  Updated: 15/Feb/13  Resolved: 12/Nov/12

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

Type: Bug Priority: Major - P3
Reporter: Zac Witte Assignee: Tad Marshall
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu 11.10 mongodb 2.2.0


Issue Links:
Duplicate
duplicates SERVER-2986 Mongo CLI responds poorly to the use ... Closed
Related
is related to SERVER-4460 Improve ctrl-C handling in the shell Closed
Operating System: Linux
Participants:

 Description   

This segfault happened when hitting ctrl+c while a stats() was waiting for IO.

More detailed version: I recently dropped a large sharded collection then implicitly recreated it by inserting a few documents and then called stats() in the mongo shell. The stats() call was taking quite a while and reading a lot from disk - way more than it should for a collection with a few documents, so I cancelled and planned to restart mongos and the shell in case it was confused about the larger collection that there previously.

mongos>
mongos> db.hourly_stats.drop()
true
mongos> db.hourly_stats.stats()
^CSun Nov 11 00:25:21 Assertion: 13111:field not found, expected type 2
0x511fa1 0x573f0b 0x57408c 0x4b7ef7 0x49f887 0x7f151f6f5420 0x7f15204184fa 0x5f6603 0x5f6619 0x5f9c04 0x5df9cc 0x5e047b 0x5e0934 0x688c85 0x53c11d 0x67eb1a 0x692ae4 0x711c1f 0x6bdf6c 0x6af9e5 
 mongo(_ZN5mongo15printStackTraceERSo+0x21) [0x511fa1]
 mongo(_ZN5mongo11msgassertedEiPKc+0x9b) [0x573f0b]
 mongo() [0x57408c]
 mongo(_ZNK5mongo11shell_utils18ConnectionRegistry30killOperationsOnAllConnectionsEb+0xf17) [0x4b7ef7]
 mongo(_Z10quitNicelyi+0x27) [0x49f887]
 /lib/x86_64-linux-gnu/libc.so.6(+0x36420) [0x7f151f6f5420]
 /lib/x86_64-linux-gnu/libpthread.so.0(recv+0x6a) [0x7f15204184fa]
 mongo(_ZN5mongo6Socket5_recvEPci+0x13) [0x5f6603]
 mongo(_ZN5mongo6Socket11unsafe_recvEPci+0x9) [0x5f6619]
 mongo(_ZN5mongo6Socket4recvEPci+0xc4) [0x5f9c04]
 mongo(_ZN5mongo13MessagingPort4recvERNS_7MessageE+0x8c) [0x5df9cc]
 mongo(_ZN5mongo13MessagingPort4recvERKNS_7MessageERS1_+0x1b) [0x5e047b]
 mongo(_ZN5mongo13MessagingPort4callERNS_7MessageES2_+0x34) [0x5e0934]
 mongo(_ZN5mongo18DBClientConnection4callERNS_7MessageES2_bPSs+0x55) [0x688c85]
 mongo(_ZN5mongo14DBClientCursor4initEv+0xbd) [0x53c11d]
 mongo(_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xea) [0x67eb1a]
 mongo(_ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xa4) [0x692ae4]
 mongo(_ZN5mongo10mongo_findEP9JSContextP8JSObjectjPlS4_+0x32f) [0x711c1f]
 mongo(js_Invoke+0x40c) [0x6bdf6c]
 mongo(js_Interpret+0x1305) [0x6af9e5]
Sun Nov 11 00:25:21 Error: field not found, expected type 2 src/mongo/shell/collection.js:155
Sun Nov 11 00:25:48 ERROR: MessagingPort::call() wrong id got:c3 expect:c5
  toSend op: 2004
  response msgid:33326805
  response len:  114
  response op:  1
  remote: 127.0.0.1:27017
Sun Nov 11 00:25:48   Assertion failure false src/mongo/util/net/message_port.cpp 241
0x511fa1 0x57461d 0x5e06dc 0x5e0934 0x688c85 0x53c11d 0x67eb1a 0x692ae4 0x711c1f 0x6bdf6c 0x6af9e5 0x6bdaff 0x584c26 0x584ca2 0x5860ae 0x71e6d4 0x4a1166 0x4a4136 0x4a6726 0x7f151f6e030d 
 mongo(_ZN5mongo15printStackTraceERSo+0x21) [0x511fa1]
 mongo(_ZN5mongo12verifyFailedEPKcS1_j+0xfd) [0x57461d]
 mongo(_ZN5mongo13MessagingPort4recvERKNS_7MessageERS1_+0x27c) [0x5e06dc]
 mongo(_ZN5mongo13MessagingPort4callERNS_7MessageES2_+0x34) [0x5e0934]
 mongo(_ZN5mongo18DBClientConnection4callERNS_7MessageES2_bPSs+0x55) [0x688c85]
 mongo(_ZN5mongo14DBClientCursor4initEv+0xbd) [0x53c11d]
 mongo(_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xea) [0x67eb1a]
 mongo(_ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xa4) [0x692ae4]
 mongo(_ZN5mongo10mongo_findEP9JSContextP8JSObjectjPlS4_+0x32f) [0x711c1f]
 mongo(js_Invoke+0x40c) [0x6bdf6c]
 mongo(js_Interpret+0x1305) [0x6af9e5]
 mongo(js_Execute+0x36f) [0x6bdaff]
 mongo(JS_EvaluateUCScriptForPrincipals+0x66) [0x584c26]
 mongo(JS_EvaluateUCScript+0x22) [0x584ca2]
 mongo(JS_EvaluateScript+0x6e) [0x5860ae]
 mongo(_ZN5mongo7SMScope4execERKNS_10StringDataERKSsbbbi+0x144) [0x71e6d4]
 mongo(_Z10execPromptRN5mongo5ScopeEPKcRSs+0x146) [0x4a1166]
 mongo(_Z5_mainiPPc+0x1ea6) [0x4a4136]
 mongo(main+0x26) [0x4a6726]
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f151f6e030d]



 Comments   
Comment by Zac Witte [ 12/Nov/12 ]

You're right - not a segfault, just the assertion error with stack trace. I think to get back to bash I hit Ctrl + c a second time.

Comment by Tad Marshall [ 11/Nov/12 ]

Hi Zac,

Thank you for the bug report.

Was there actually a segfault, or are you just seeing a pair of ugly stack traces followed by an unexpected exit? The log fragment you posted does not show a segfault.

I think that this is another manifestation of poor handling of ctrl-C in the shell, as described in SERVER-2986. I have linked your report with that ticket.

In the first stack trace, you can see that the code has called 'quitNicely' (in line 11), which is probably poor behavior in itself, aside from the ugly stack trace. If you found yourself back at the bash prompt after hitting ctrl-C, it is probably a result of the code's decision to exit.

I'll close this as a duplicate of SERVER-2986 unless you think that this is a completely separate case. Let me know what you think, thanks!

Tad

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