Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-34160

Mongo client run buffered command when terminated.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.4.17, 3.6.7, 4.0.1, 4.1.1
    • Affects Version/s: 3.4.10
    • Component/s: Shell
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.0, v3.6, v3.4
    • Hide
      ## ------------------------
      ## Terminal 1
      ## ------------------------
      $ echo $$
      65551
      $ mongo admin -uuser -p
      MongoDB shell version v3.4.10
      Enter password:
      connecting to: mongodb://127.0.0.1:27017/admin
      MongoDB server version: 3.4.10
      
      shard01:PRIMARY (admin) 17:08:23> use admin
      switched to db admin
      shard01:PRIMARY (admin) 17:08:26> db.test.find()  ==> No documents in this collection
      shard01:PRIMARY (admin) 17:08:33> db.test.insert({text:"not yet executed"})  ==> Not yet execute this command (just typing)
      
      ## ------------------------
      ## Terminal 2
      ## ------------------------
      $ kill -SIGKILL 65551   ==> Kill terminal-1
      
      ## After terminal-1 is killed
      $ mongo admin -uuser -p
      MongoDB shell version v3.4.10
      Enter password:
      connecting to: mongodb://127.0.0.1:27017/admin
      MongoDB server version: 3.4.10
      
      shard01:PRIMARY (admin) 17:09:30> use admin
      switched to db admin
      shard01:PRIMARY (admin) 17:09:31> db.test.find()
      { "_id" : ObjectId("5abb4da6f63b9d80af086edd"), "text" : "not yet executed" }  ==> Document is inserted 
      
      Show
      ## ------------------------ ## Terminal 1 ## ------------------------ $ echo $$ 65551 $ mongo admin -uuser -p MongoDB shell version v3.4.10 Enter password: connecting to: mongodb://127.0.0.1:27017/admin MongoDB server version: 3.4.10 shard01:PRIMARY (admin) 17:08:23> use admin switched to db admin shard01:PRIMARY (admin) 17:08:26> db.test.find() ==> No documents in this collection shard01:PRIMARY (admin) 17:08:33> db.test.insert({text:"not yet executed"}) ==> Not yet execute this command (just typing) ## ------------------------ ## Terminal 2 ## ------------------------ $ kill -SIGKILL 65551 ==> Kill terminal-1 ## After terminal-1 is killed $ mongo admin -uuser -p MongoDB shell version v3.4.10 Enter password: connecting to: mongodb://127.0.0.1:27017/admin MongoDB server version: 3.4.10 shard01:PRIMARY (admin) 17:09:30> use admin switched to db admin shard01:PRIMARY (admin) 17:09:31> db.test.find() { "_id" : ObjectId("5abb4da6f63b9d80af086edd"), "text" : "not yet executed" } ==> Document is inserted
    • Platforms 2018-07-02

      When mongo client(mongo shell) is running within linux shell,
      if linux shell is killed or terminated (sigterm), mongo client run buffered command(input command but not yet executed by ENTER/RETURN keyboard) before terminated.

      I don't know this is mongo shell issue or linux terminal.
      But this issue is not happened another CLI client(like mysql client in same scenario).

      This is relatively critical issue what command user typed on mongo client shell.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            sunguck.lee@gmail.com 아나 하리
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: