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

Helpful error message when trying to eval something which isn't code

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.0
    • Affects Version/s: None
    • Component/s: JavaScript, Shell, Stability
    • None

      Would be nice to have the server to not die when trying to eval something which it can't eval.

      // SHELL

      var invalid = {};
      db.eval(invalid.reference);
      Thu Sep 3 14:07:39 JS Error: Error: error doing query: failed (anon):118

      // MONGO DAEMON
      db/dbeval.cpp:41: failed assertion `e.type() == Code || e.type() == CodeWScope || e.type() == String'
      Thu Sep 3 14:07:39 Got signal: 6 (Abort trap).
      Thu Sep 3 14:07:39 Last op: { opid: 2, active: 1, secs_running: 0, op: "query", ns: "test.$cmd", query: "

      { $eval: undefined }

      ", inLock: 1, client: "127.0.0.1:50082" }
      Thu Sep 3 14:07:39 Backtrace:
      0x13ada8 0x965622bb 0xffffffff 0x3ed26 0x13876b 0x13d012 0x13d6b4 0x143e3c 0x2216
      0 mongod 0x0013ada8 _ZN5mongo10abruptQuitEi + 1448
      1 libSystem.B.dylib 0x965622bb _sigtramp + 43
      2 ??? 0xffffffff 0x0 + 4294967295
      3 mongod 0x0003ed26 _ZN5mongo8Listener6listenEv + 134
      4 mongod 0x0013876b _ZN5mongo6listenEi + 699
      5 mongod 0x0013d012 _ZN5mongo14_initAndListenEiPKc + 1282
      6 mongod 0x0013d6b4 _ZN5mongo13initAndListenEiPKc + 36
      7 mongod 0x00143e3c main + 26364
      8 mongod 0x00002216 start + 54
      Thu Sep 3 14:07:39 dbexit:
      Thu Sep 3 14:07:39 closeAllFiles() finished
      Thu Sep 3 14:07:39 dbexit: really exiting now
      Abort trap

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            sandstrom sandstrom
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: