Uh oh!
There was an error while loading. Please reload this page.
test: improve disable AsyncLocalStorage test - #31998
Conversation
vdeturckheim
commented
Feb 28, 2020
Can we fast-track this one? It just adds an assertion to a test. |
nodejs-github-bot
commented
Feb 28, 2020
puzpuzpuz
commented
Feb 28, 2020
Looks like tests are flaky. As far as I can see, failed tests are not related with this PR. |
nodejs-github-bot
commented
Feb 28, 2020
vdeturckheim
commented
Feb 28, 2020
@puzpuzpuz something went wrong in CI, I restarted it |
nodejs-github-bot
commented
Feb 28, 2020
There's actually a deeper issue than that. 'use strict';require('../common');constassert=require('assert');const{ AsyncLocalStorage }=require('async_hooks');constasyncLocalStorage=newAsyncLocalStorage();conststore={};asyncLocalStorage.runSyncAndReturn(store,()=>{process.nextTick(()=>{// This will fail because the second `runSyncAndReturn` re-enabled the storage// between when it was disabled and when the `nextTick` callback runs.assert.strictEqual(asyncLocalStorage.getStore(),undefined);});asyncLocalStorage.disable();});asyncLocalStorage.runSyncAndReturn(store,()=>{assert.strictEqual(asyncLocalStorage.getStore(),store);});In this example, they are in the same sync tick, but imagine two runs from two separate http requests with a less immediate async task like a |
Your snippet shows expected behavior which is described in the doc: https://github.com/nodejs/node/blob/311e12b96201c01d6c66c800d8cfc59ebf9bc4ae/doc/api/async_hooks.md#asynclocalstoragedisable This behavior (and the general approach for In any case, this discussion seems to be unrelated with changes from this PR and should be moved into a GH issue or a separate PR. WDYT? |
Qard
commented
Feb 29, 2020
Ah, hmm...okay. I must have missed that. Seems like very strange behaviour to me though. It makes it impossible to actually fully disable the storage. 😕 Anyway, yes, we can take this concern elsewhere. |
nodejs-github-bot
commented
Mar 1, 2020
puzpuzpuz
commented
Mar 2, 2020
Another flaky CI run 😢. Could someone re-run it? |
nodejs-github-bot
commented
Mar 2, 2020
6387b29 to
d0f9175Comparepuzpuzpuz
commented
Mar 2, 2020
I have rebased over the latest |
nodejs-github-bot
commented
Mar 2, 2020
PR-URL: #31998 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
vdeturckheim
commented
Mar 2, 2020
Landed in 68e36ad |
PR-URL: #31998 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
puzpuzpuz
commented
Mar 17, 2020
v12 backport: #32318 |
PR-URL: nodejs#31998 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#31998 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #31998 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Improves
test-async-local-storage-enable-disable.jstest, as it wasn't covering.disable()method's behavior as it should. See #31950 (comment) for more details.cc @Qard@vdeturckheim
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes