Skip to content

benchmark: fix error on server close in AsyncLocalStorage benchmark - #32503

Closed
puzpuzpuz wants to merge 1 commit into
nodejs:masterfrom
puzpuzpuz:fix-async-resource-vs-destroy-benchmark
Closed

benchmark: fix error on server close in AsyncLocalStorage benchmark#32503
puzpuzpuz wants to merge 1 commit into
nodejs:masterfrom
puzpuzpuz:fix-async-resource-vs-destroy-benchmark

Conversation

@puzpuzpuz

@puzpuzpuzpuzpuzpuz commented Mar 26, 2020

Copy link
Copy Markdown
Member

Fixes AsyncLocalStorage type from benchmark/async_hooks/async-resource-vs-destroy.js by adding undefined check for the store (CLS context). Before this fix it could fail when the server is closed (and ALS instance is disabled), which may lead to calls to getCLS() method of the benchmark in the following part of the request handling code:

setTimeout(()=>{// the server may be already closed when this (and the next one) callback is runreadFile(__filename,()=>{res.setHeader('content-type','application/json');res.end(JSON.stringify({cls: getCLS()}));});},10);

Other types within the benchmark already had similar checks, so that's why they weren't failing.

  • Also removes redundant checks from executionAsyncResource type. Reason: the final implementation of executionAsyncResource() never returns null.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. benchmark Issues and PRs related to the benchmark subsystem. labels Mar 26, 2020
@puzpuzpuzpuzpuzpuz changed the title benchmark: fix error on server close in ALS benchmarkbenchmark: fix error on server close in AsyncLocalStorage benchmarkMar 26, 2020
@puzpuzpuz
puzpuzpuzforce-pushed the fix-async-resource-vs-destroy-benchmark branch from 7fda473 to 39374a2CompareMarch 26, 2020 12:22

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mhdawsonmhdawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mhdawsonmhdawson added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 1, 2020
@mhdawson

Copy link
Copy Markdown
Member

CI run: https://ci.nodejs.org/job/node-test-pull-request/30348/

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@puzpuzpuz
puzpuzpuzforce-pushed the fix-async-resource-vs-destroy-benchmark branch from 39374a2 to 2239ecbCompareApril 2, 2020 07:47
@puzpuzpuz

Copy link
Copy Markdown
MemberAuthor

The test failure in test/node-api/test_buffer/test.js seems unrelated, but I did a rebase over the latest master, as it may be already fixed.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina

Copy link
Copy Markdown
Member

Landed in 7e664a5

@mcollinamcollina closed this Apr 2, 2020
mcollina pushed a commit that referenced this pull request Apr 2, 2020
PR-URL: #32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@puzpuzpuz
puzpuzpuz deleted the fix-async-resource-vs-destroy-benchmark branch April 2, 2020 12:59
@puzpuzpuz

Copy link
Copy Markdown
MemberAuthor

v12.x backport PR: #32318

BethGriggs pushed a commit that referenced this pull request Apr 7, 2020
PR-URL: #32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
targos pushed a commit that referenced this pull request Apr 12, 2020
PR-URL: #32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@targostargos mentioned this pull request Apr 13, 2020
puzpuzpuz added a commit to puzpuzpuz/node that referenced this pull request Apr 14, 2020
PR-URL: nodejs#32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@targostargos removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 25, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
PR-URL: nodejs#32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
PR-URL: #32503
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@targostargos mentioned this pull request May 2, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooksIssues and PRs related to the async hooks subsystem.benchmarkIssues and PRs related to the benchmark subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsyncLocalStorage benchmark broken

8 participants

@puzpuzpuz@mhdawson@nodejs-github-bot@mcollina@cjihrig@vdeturckheim@Flarna@targos