[SERVER-19727] BulkWriteError and WriteCommandError capture less info in MozJS than v8 Created: 03/Aug/15  Updated: 19/Sep/15  Resolved: 04/Aug/15

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.1.7
Fix Version/s: 3.1.7

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Mira Carey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platform 7 08/10/15
Participants:

 Description   

BulkWriteError and WriteCommandError called captureStackTrace under v8, which provided a more detailed stack trace than the native one we get by inheriting from Error.

In particular, captureStackTrace():

  • actually generates a stack from our error constructors, rather than using an out of date one from assignment of the BulkWriteError.prototype
  • adds the stringification of the custom error type to the .stack property


 Comments   
Comment by Githook User [ 04/Aug/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19727 captureStackTrace bulk_api emulation

form stack traces that have more information and look more like v8
captureStackTrace stack traces.
Branch: master
https://github.com/mongodb/mongo/commit/1febdbe599d63268fbc5b8415587a0c489f48874

Comment by Mira Carey [ 03/Aug/15 ]

v8:

BulkWriteError({
        "writeErrors" : [
                {
                        "index" : 1,
                        "code" : 11000,
                        "errmsg" : "E11000 duplicate key error collection: test.test index: _id_ dup key: { : 1.0 }",
                        "op" : {
                                "_id" : 1
                        }
                }
        ],
        "writeConcernErrors" : [ ],
        "nInserted" : 1,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
    at toError (src/mongo/shell/bulk_api.js:335:16)
    at execute (src/mongo/shell/bulk_api.js:1162:27)
    at repro.js:9:10

Comment by Mira Carey [ 03/Aug/15 ]

updated:

BulkWriteError({
        "writeErrors" : [
                {
                        "index" : 1,
                        "code" : 11000,
                        "errmsg" : "E11000 duplicate key error collection: test.test index: _id_ dup key: { : 1.0 }",
                        "op" : {
                                "_id" : 1
                        }
                }
        ],
        "writeConcernErrors" : [ ],
        "nInserted" : 1,
        "nUpserted" : 0,
        "nMatched" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
BulkWriteError@src/mongo/shell/bulk_api.js:372:44
BulkWriteResult/this.toError@src/mongo/shell/bulk_api.js:335:16
Bulk/this.execute@src/mongo/shell/bulk_api.js:1162:1
@repro.js:9:5

Comment by Mira Carey [ 03/Aug/15 ]

Current stack for a bulk write failure:

_bulk_api_module<@src/mongo/shell/bulk_api.js:379:30
@src/mongo/shell/bulk_api.js:4:25

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