[SERVER-25764] ImplScope needs a background task to invoke it's interrupt callback Created: 23/Aug/16  Updated: 08/Jan/24  Resolved: 29/Aug/16

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 3.3.11
Fix Version/s: 3.2.14, 3.3.12

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

Issue Links:
Backports
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.2
Sprint: Platforms 2016-08-26, Platforms 2016-09-19
Participants:
Linked BF Score: 0

 Description   

JS jobs need some off thread mechanism to invoke their interrupt callback (to do things like check if the operation has been interrupted).

In the absence of someone trigger interrupts, they only occur during other operations (like gc).



 Comments   
Comment by Githook User [ 05/May/17 ]

Author:

{u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}

Message: SERVER-25764 Interrupt javascript periodically.

(cherry picked from commit 1875792bdc435c695aca1b6b57be7486e7df70c5)
Branch: v3.2
https://github.com/mongodb/mongo/commit/317a3f627be5adf149d857a248d344342897e5f9

Comment by Mira Carey [ 06/Sep/16 ]

ramon.fernandez, putting in a backport request for this one. It finishes the work in SERVER-25056 (which we did backport) and is designed to fix BF-1900

Comment by Githook User [ 29/Aug/16 ]

Author:

{u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}

Message: SERVER-25764 Interrupt javascript periodically.
Branch: master
https://github.com/mongodb/mongo/commit/1875792bdc435c695aca1b6b57be7486e7df70c5

Comment by Mira Carey [ 25/Aug/16 ]

I don't think there's a configuration option for it, (I mis-remembered the api when we ran down the operation context plumbing change), but it should just be a matter of invoking JS_RequestInterruptCallback on an interval.

For an implementation, let's plug into the existing timer facility and use the deadline timer there.

Though, on reflection I wonder if we're doing that right either. Specifically, I'm concerned that re-entrancy into ::invoke with a new timeoutMs might overwrite the old timeout in bad ways. So we may want to think about if we have to fix that while we're in there.

In terms of interval: once a second.

Comment by Andrew Morrow (Inactive) [ 24/Aug/16 ]

Have we looked into whether there is some configuration or setup required to ask SM to do that? Perhaps it doesn't do it by default.

Comment by Jonathan Reams [ 24/Aug/16 ]

Should we just interrupt periodically - if so, how often between interrupts? Shouldn't the javascript engine just do this for us? I thought SpiderMonkey would call the interrupt callback periodically no matter what.

Generated at Thu Feb 08 04:10:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.