[SERVER-8285] DB accessors intercepting prototype access to 'this' Created: 22/Jan/13  Updated: 11/Jul/16  Resolved: 12/Feb/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.3.2
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Ben Becker
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

This is not 100% of the time but simple reproducer is

mongo 
> set verbose true
set verbose to true
> db.c1.insert({})
Inserted 1 record(s) in NaNms



 Comments   
Comment by auto [ 12/Feb/13 ]

Author:

{u'date': u'2013-02-12T19:17:39Z', u'name': u'Ben Becker', u'email': u'ben.becker@10gen.com'}

Message: SERVER-8285: fix shell's verbose mode by avoiding collision with db/collection intereptors
Branch: master
https://github.com/mongodb/mongo/commit/15a994b5fd9396dc236fda48a95a2bb7c2fb3b99

Comment by Ben Becker [ 01/Feb/13 ]

I think this also has the potential to interfere with GLE, at least when called from this.getLastErrorCmd(1) in db.js. For now, I think the best approach is to simply disambiguate variables in the object instance scope so they are not caught by our 'collectionGetter' interceptor.

Comment by Ben Becker [ 23/Jan/13 ]

One manifestation of this bug is that verbose mode displays execution times as "NaNms". Apparently our interceptor for 'DB' (collectionGetter) is catching JS calls from the prototype for 'this.startTime', and translating to '<dbname>.startTime'.

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