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

Javascript shell max call stack exceeded on deeply nested json object

    • Minor Change
    • ALL
    • Hide

      MongoDB shell version: 2.3.3-pre-
      connecting to: test
      Server has startup warnings:
      Wed Jan 23 14:52:39.843 [initandlisten]
      Wed Jan 23 14:52:39.844 [initandlisten] ** NOTE: This is a development version (2.3.3-pre-) of MongoDB.
      Wed Jan 23 14:52:39.844 [initandlisten] ** Not recommended for production.
      Wed Jan 23 14:52:39.844 [initandlisten]
      Wed Jan 23 14:52:39.844 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
      Wed Jan 23 14:52:39.844 [initandlisten]
      > var doc = {}
      > var cur = doc;
      > for( var i = 0; i< 65536; i++ ) {
      ... cur[i] = {}
      ... cur = cur[i];
      ... }
      { }
      > cur['a'] = 'foo'
      foo
      > doc
      Wed Jan 23 15:00:51.265 javascript execution failed src/mongo/shell/types.js:527 RangeError: Maximum call stack size exceeded
      tojsonObject = function(x, indent, nolint){
      ^

      >

      Show
      MongoDB shell version: 2.3.3-pre- connecting to: test Server has startup warnings: Wed Jan 23 14:52:39.843 [initandlisten] Wed Jan 23 14:52:39.844 [initandlisten] ** NOTE: This is a development version (2.3.3-pre-) of MongoDB. Wed Jan 23 14:52:39.844 [initandlisten] ** Not recommended for production. Wed Jan 23 14:52:39.844 [initandlisten] Wed Jan 23 14:52:39.844 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 Wed Jan 23 14:52:39.844 [initandlisten] > var doc = {} > var cur = doc; > for( var i = 0; i< 65536; i++ ) { ... cur [i] = {} ... cur = cur [i] ; ... } { } > cur ['a'] = 'foo' foo > doc Wed Jan 23 15:00:51.265 javascript execution failed src/mongo/shell/types.js:527 RangeError: Maximum call stack size exceeded tojsonObject = function(x, indent, nolint){ ^ >
    • Platforms 2017-01-23

      trying to create a deeply nested json document. shell gives error when trying to display.

            Assignee:
            matt.cotter Matt Cotter
            Reporter:
            jsr Jared Rosoff
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: