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

Segmentation fault on aarch64 #335

Closed
jhoogstraat opened this issue Feb 10, 2022 · 2 comments
Closed

Segmentation fault on aarch64 #335

jhoogstraat opened this issue Feb 10, 2022 · 2 comments

Comments

@jhoogstraat
Copy link

jhoogstraat commented Feb 10, 2022

I got a segmentation fault using the library on my raspi 4 in a docker container.
segfault-handler reported the following stacktrace:

PID 54 received SIGSEGV for address: 0x1000001b7
/bot/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x2b54)[0x7f81183b54]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7f927cd7d8]
/usr/lib/aarch64-linux-gnu/libssl.so.1.1(SSL_get_peer_certificate+0x18)[0x7f721f3f58]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x662d8)[0x7f723022d8]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x6995c)[0x7f7230595c]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x6a7c4)[0x7f723067c4]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x2d2ac)[0x7f722c92ac]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x42790)[0x7f722de790]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(+0x439fc)[0x7f722df9fc]
/usr/lib/aarch64-linux-gnu/libcurl.so.4(curl_multi_socket_action+0x30)[0x7f722dfb84]
/bot/node_modules/node-libcurl/lib/binding/node_libcurl.node(_ZN11NodeLibcurl5Multi9OnTimeoutEP10uv_timer_s+0x120)[0x7f901bdc00]
node[0x14fb418]
node(uv_run+0x78)[0x14ff820]
node(_ZN4node13SpinEventLoopEPNS_11EnvironmentE+0x124)[0xa6998c]
node(_ZN4node16NodeMainInstance3RunEPKNS_16EnvSerializeInfoE+0x168)[0xb5a178]
node(_ZN4node5StartEiPPc+0x1dc)[0xae656c]
/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe8)[0x7f9235f218]
node[0xa67cf4]
Segmentation fault

The error occurs only on aarch64, x86 works fine.
This test script exhibits the segmentation fault:

import { curly } from "node-libcurl";

async function req(url: string): Promise<any> {
  console.log(url)
  const response = await curly.get(url, { verbose: true })
  console.log("Response from", url)
  return response.data
}

const res = await req('https://google.com')
console.log(res)

const arr = [1, 2, 3, 4].forEach(async element => {
  const res = await req('https://google.com')
  console.log(element, res)
});

console.log("Finished")

The use case in the application is equivalent to the forEach example shown above, but the single request before already proeduces the seg fault.

The circumstances are very specific, but I try my best to completely describe the situation

  • Device: Raspberry Pi 4
  • Linux: 5.10.92-v8+ (aarch64) GNU/Linux
  • Docker Image: node:latest-slim
  • Node version: 17.4.0
  • Curl version: 7.74.0 (aarch64-unknown-linux-gnu)
  • OpenSSL version: 1.1.1k 25 Mar 2021

EDIT 1:
The error occurs because node17 updated openssl to 3.0.0, which is no compatible with the system version (1.1.1k).
Downgrading to Node16, which still uses 1.1.1 works.

@JCMais
Copy link
Owner

JCMais commented Feb 12, 2022

I suppose you had to build the addon from source, right?

This is probably the same issue described on #164. Basically, if you are building from the source, you must build the addon using the same OpenSSL version as the one used by Node.js itself. For more context please see the original issue. It is not something that can be easily fixed from the add-on side.

@JCMais JCMais closed this as completed Feb 12, 2022
@jhoogstraat
Copy link
Author

Yeah, that was it. Didn't knew that node updated OpenSSL.

I guess this issue can still purpose as a guideline for user with the same issues on arm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants