Skip to content

Conversation

addaleax
Copy link
Collaborator

@addaleax addaleax commented Apr 6, 2021

MONGOSH-666

Clear the require cache after an interrupt occurred.

This is currently making our test suite flaky, because the interrupt
can also occur during the babel transformation of the async rewriter
(either one), which lazy-loads other modules from babel packages.

If those are loaded incompletely during the first require() call,
they are still left in the cache (as interruptor fully stops
execution and also skips catch/finally handlers which would remove
them from the cache). Subsequent loads receive incomplete module
exports in that case.

One alternative would be to try to only wrap the actual evaluate
call in the runInterruptible() wrapper. This seems a bit cleaner,
but would also require changing the Runtime interface a bit
in a way that cannot be proxied across the child process/Worker
barrier.

…ONGOSH-666

Clear the require cache after an interrupt occurred.

This is currently making our test suite flaky, because the interrupt
can also occur during the babel transformation of the async rewriter
(either one), which lazy-loads other modules from babel packages.

If those are loaded incompletely during the first `require()` call,
they are still left in the cache (as `interruptor` fully stops
execution and also skips catch/finally handlers which would remove
them from the cache). Subsequent loads receive incomplete module
exports in that case.

One alternative would be to try to only wrap the actual `evaluate`
call in the `runInterruptible()` wrapper. This seems a bit cleaner,
but would also require changing the `Runtime` interface a bit
in a way that cannot be proxied across the child process/Worker
barrier.
@addaleax addaleax requested a review from gribnoysup April 6, 2021 14:29
@gribnoysup
Copy link
Collaborator

Just started reviewing, this is just a branch name appreciation comment 666-dev 😈

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah, what an interesting issue, didn't even hit me that something like this could happen! I guess as soon as you allow to casually interrupt the runtime you can run into all kind of weird cases 🤔

@addaleax addaleax merged commit b1afc77 into master Apr 7, 2021
@addaleax addaleax deleted the 666-dev branch April 7, 2021 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants