Open JCMais opened 4 years ago
Dockerfile to test with the latest curl version support quic-draft-29
Prebuilt version: https://hub.docker.com/repository/docker/bigsisl/node-libcurl-http3
llnode dump;
Process 33180 stopped
* thread #1, name = 'node', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x000000000166eb59 node`OPENSSL_cleanse + 41
node`OPENSSL_cleanse:
-> 0x166eb59 <+41>: movb %al, (%rdi)
0x166eb5b <+43>: leaq -0x1(%rsi), %rsi
0x166eb5f <+47>: leaq 0x1(%rdi), %rdi
0x166eb63 <+51>: jmp 0x166eb50 ; <+32>
gdb stacktrace:
#0 __GI___libc_free (mem=0x2e621a6a1744140f) at malloc.c:3103
#1 0x00000000014ed05e in BN_free ()
#2 0x00000000014aa0dd in SSL_SRP_CTX_free ()
#3 0x00000000014662ce in ssl3_free ()
#4 0x0000000001471ae6 in SSL_free.part.26 ()
#5 0x00007fffe7de2bfa in qs_disconnect () from /usr/local/lib/libcurl.so.4
#6 0x00007fffe7de421b in Curl_quic_is_connected () from /usr/local/lib/libcurl.so.4
#7 0x00007fffe7d92798 in Curl_is_connected () from /usr/local/lib/libcurl.so.4
#8 0x00007fffe7dba4e0 in multi_runsingle () from /usr/local/lib/libcurl.so.4
#9 0x00007fffe7dbb883 in multi_socket () from /usr/local/lib/libcurl.so.4
#10 0x00007fffe7dbb9f4 in curl_multi_socket_action () from /usr/local/lib/libcurl.so.4
#11 0x00007ffff426da8c in NodeLibcurl::Multi::OnSocket (handle=<optimized out>, status=<optimized out>, events=<optimized out>) at ../src/Multi.cc:153
#12 0x0000000001336c50 in uv.io_poll () at ../deps/uv/src/unix/linux-core.c:431
#13 0x00000000013250f8 in uv_run (loop=0x4291ea0 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:381
#14 0x0000000000a6b9b4 in node::NodeMainInstance::Run() ()
#15 0x00000000009fae81 in node::Start(int, char**) ()
#16 0x00007ffff6ca3b97 in __libc_start_main (main=0x993d80 <main>, argc=2, argv=0x7fffffffda58, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffda48) at ../csu/libc-start.c:310
#17 0x000000000099529c in _start ()
Found some things, a ng_flush_egress(conn, sockfd, qs)
fails with CURLE_SEND_ERROR
. This happens at:
https://github.com/curl/curl/blob/1313d7a35620e40c765bd8dc4138916264f20e61/lib/vquic/ngtcp2.c#L1692-L1718
because of:
https://github.com/curl/curl/blob/1313d7a35620e40c765bd8dc4138916264f20e61/lib/vquic/ngtcp2.c#L1862-L1866
(ngtcp2_conn_write_pkt returned error: -502 / NGTCP2_ERR_CALLBACK_FAILURE)
I am not sure if the bug lies with node-libcurl or curl it self. It does seems strange thought, since after the CURLE_SEND_ERROR
libcurl tries to disconnect and the ssl pointer seems to be not correct, therefore it fails => SIGFAULT.
Could you check if you are using the same OpenSSL version than the one being used by the Node.js you are building against?
You can get the Node.js OpenSSL version by running node -e "console.log(process.versions)"
.
If they are different, this can cause some weird issues, like the one you are having. The akamai fork has some branches for the latest OpenSSL versions, like: https://github.com/akamai/openssl/tree/OpenSSL_1_1_1f-quic, but I don't know if they do work or not.
I am testing it locally again, but in the container i use OpenSSL_1_1_1g-quic-draft-29
and
root@4808d4ebfb95:/app# node -e "console.log(process.versions)"
{
node: '14.4.0',
v8: '8.1.307.31-node.33',
uv: '1.37.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.16.0',
modules: '83',
nghttp2: '1.41.0',
napi: '6',
llhttp: '2.0.4',
openssl: '1.1.1g',
cldr: '37.0',
icu: '67.1',
tz: '2019c',
unicode: '13.0'
}
Therefore might be something else
Nope, getting the same error CURLE_SEND_ERROR
followed by SIGFAULT
The same error happens when using only an Easy
instance?
Just in case you want to check if this happens with libcurl only, there are some sample code available on libcurl documentation that you can use, like https://curl.haxx.se/libcurl/c/http3.html and https://curl.haxx.se/libcurl/c/multi-uv.html (need to also build and link libuv).
The second example above would be almost exactly what we do in the addon when you use a Multi
/ Curl
instance.
Seems like bare multi-uv and http3 example work with the version I compiled, I will try to run those examples now as part as nodejs callbacks, hopefully I will figure something out.
You have successfully loaded quic.rocks using QUIC!
https://quic.rocks:4433/ DONE CODE [No error] Contentosboxes@osboxes:~/http-3-test-environment/src/libcurl-client/build$ ./http3-client https://quic.rocks:4433 Suppported: HTTP/3 ALTSVC connectiong to 'https://quic.rocks:4433' resHttp3: [0]You have successfully loaded quic.rocks using QUIC!
```
OpenSSL does not provide a production-ready version with QUIC enabled, we will need to wait until then: https://github.com/openssl/openssl/pull/8797
For the QUIC/HTTP3 backend we will need to use
ngtcp2
asquiche
only works with BoringSSL.To test the QUIC implementation, the
ngtcp2
team offers a patchedOpenSSL
version with QUIC support here: https://github.com/tatsuhiro-t/openssl/tree/openssl-quic or we could just built openssl from the akamai branch in the PR above.