Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL.canParse fails when stressed #48816

Closed
joacub opened this issue Jul 17, 2023 · 7 comments
Closed

URL.canParse fails when stressed #48816

joacub opened this issue Jul 17, 2023 · 7 comments
Labels
confirmed-bug Issues with confirmed bugs. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Comments

@joacub
Copy link

joacub commented Jul 17, 2023

Version

20.4.0

Platform

any

Subsystem

No response

What steps will reproduce the bug?

while (true) {
  const test = URL.canParse('/ ', 'http://n');
  console.log(test);
}

How often does it reproduce? Is there a required condition?

after some stress

What is the expected behavior? Why is that the expected behavior?

same result as first one

What do you see instead?

return false at some point of stress

Additional information

No response

@joacub
Copy link
Author

joacub commented Jul 17, 2023

another test in my end doing a 100ms wait wil not have the same beharviour in that case return true always:

import { setTimeout } from 'timers/promises';
while (true) {
  await setTimeout(100);
  const test = URL.canParse('/ ', 'http://n');
  console.log(test);
}

this will also fail at some point so maybe the 100 ms will aso fail just didnt get the point were it will fail

import { setTimeout } from 'timers/promises';
while (true) {
  await setTimeout(1);
  const test = URL.canParse('/ ', 'http://n');
  console.log(test);
}

@joacub
Copy link
Author

joacub commented Jul 17, 2023

@anonrig i think you are following this changes so you may have all the details about this

@anonrig anonrig added whatwg-url Issues and PRs related to the WHATWG URL implementation. confirmed-bug Issues with confirmed bugs. labels Jul 17, 2023
@anonrig
Copy link
Member

anonrig commented Jul 17, 2023

Thanks for the bug report. I confirm this is indeed a really awkward bug. cc @nodejs/url

@anonrig
Copy link
Member

anonrig commented Jul 17, 2023

This is probably due to v8 Fast API. When you call it multiple times, it triggers v8 fast api.

@anonrig
Copy link
Member

anonrig commented Jul 17, 2023

@KhafraDev disabling/commenting out V8 Fast API fixes the bug

@anonrig
Copy link
Member

anonrig commented Jul 17, 2023

@joacub I opened a PR to fix this: #48817

@joacub
Copy link
Author

joacub commented Jul 17, 2023

@joacub I opened a PR to fix this: #48817

Thank you so much sir, we are facing many many issues due to this and our websites goes down very often, thank you so much for your work

kodiakhq bot pushed a commit to vercel/next.js that referenced this issue Jul 18, 2023
> nodejs/node#48816

This was an unsafe change that caused errors to the user due to a bug in Node and a fix will get upstreamed soon but in the meantime we should reverse this.

Reverts #52353
@anonrig anonrig closed this as completed Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants