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

OpenBSD: Crash on dns.resolve() #52439

Closed
VlkrS opened this issue Apr 9, 2024 · 6 comments · Fixed by #55521
Closed

OpenBSD: Crash on dns.resolve() #52439

VlkrS opened this issue Apr 9, 2024 · 6 comments · Fixed by #55521
Labels
dns Issues and PRs related to the dns subsystem.

Comments

@VlkrS
Copy link

VlkrS commented Apr 9, 2024

Version

18.19.1

Platform

OpenBSD 7.5-current

Subsystem

src/cares-wrap.cc

What steps will reproduce the bug?

On OpenBSD 7.5-current,
with node 18.19.1, built with --shared-libuv, --shared-cares
and libuv 1.48.0, libcares 1.28.0

(same for node 18.20.1)

Welcome to Node.js v18.19.1.
Type ".help" for more information.
> const dns=require('dns');
undefined
> dns.resolve4('www.google.com','AAAA',(err, records) => {});
QueryReqWrap {
  bindingName: 'queryA',
  callback: [Function (anonymous)],
  hostname: 'www.google.com',
  oncomplete: [Function: onresolve],
  ttl: false
}
> node[11838]: ../src/cares_wrap.cc:685:static void node::cares_wrap::ChannelWrap::AresTimeout(uv_timer_t *): Assertion `(false) == (channel->task_list()->empty())' failed.
 1: 0x98b84fd21e0 node::Abort() [node]
 2: 0x98b84fd1eda node::Assert(node::AssertionInfo const&) [node]
 3: 0x98b84f097c4 node::cares_wrap::ChannelWrap::AresTimeout(uv_timer_s*) [node]
 4: 0x98e7c97adc8 uv_timer_get_due_in [/usr/local/lib/libuv.so.4.2]
 5: 0x98e7c9807c0 uv_run [/usr/local/lib/libuv.so.4.2]
 6: 0x98b84ef2605 node::SpinEventLoop(node::Environment*) [node]
 7: 0x98b850230a3 node::NodeMainInstance::Run() [node]
 8: 0x98b84f8d010 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResult const*) [node]
 9: 0x98b84f8d21f node::Start(int, char**) [node]
Abort trap (core dumped)

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

Occurs on every attempt

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

No crash :-)

What do you see instead?

A crash due to a failed assertion, see above.

Additional information

I realize that node v18.x chose to revert libuv to 1.44.2 and that the project cannot support non-tested setups such as this one, but since I confirmed that on FreeBSD with the same versions of node, libuv and libcares the problem does not occur, I was hoping that you might be able to suggest under which conditions the assertion in cares-wrap.cc:685 might fail.

@theanarkh
Copy link
Contributor

Will other DNS queries cause the crash ?

@VlkrS
Copy link
Author

VlkrS commented Apr 10, 2024

Will other DNS queries cause the crash ?

Yes, the name doesn't matter and neither does the rrtype - both 'A' and 'AAAA' queries lead to the same crash

@theanarkh
Copy link
Contributor

theanarkh commented Apr 11, 2024

require('dns').lookup('www.google.com', () => {}) also cause the crash (www.google.com or other host) ?

@VlkrS
Copy link
Author

VlkrS commented Apr 11, 2024

Nope, that works:

> require('dns').lookup('www.google.com',(e, r) => { console.log(r) });
GetAddrInfoReqWrap {
  callback: [Function (anonymous)],
  family: 0,
  hostname: 'www.google.com',
  oncomplete: [Function: onlookup]
}
> 142.250.185.68

@RedYetiDev RedYetiDev added the dns Issues and PRs related to the dns subsystem. label Apr 20, 2024
@VlkrS
Copy link
Author

VlkrS commented May 7, 2024

The same issue occurs on 20.12.2

@VlkrS
Copy link
Author

VlkrS commented May 7, 2024

Tracked it down to an OpenBSD specific bug in c-ares.

@VlkrS VlkrS closed this as completed May 7, 2024
VlkrS added a commit to VlkrS/c-ares that referenced this issue May 8, 2024
As described in c-ares#753 the change merged with c-ares#659 is ill-advised and leads to breakage in applications using c-ares on OpenBSD. 

See also nodejs/node#52439
bradh352 pushed a commit to c-ares/c-ares that referenced this issue May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit to c-ares/c-ares that referenced this issue May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit to c-ares/c-ares that referenced this issue May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit to c-ares/c-ares that referenced this issue May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit to c-ares/c-ares that referenced this issue May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
nodejs-github-bot pushed a commit that referenced this issue Nov 1, 2024
RafaelGSS pushed a commit that referenced this issue Nov 1, 2024
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
tpoisseau pushed a commit to tpoisseau/node that referenced this issue Nov 21, 2024
ruyadorno pushed a commit that referenced this issue Nov 27, 2024
ruyadorno pushed a commit that referenced this issue Nov 27, 2024
ruyadorno pushed a commit that referenced this issue Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dns Issues and PRs related to the dns subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants