wasmedge-quickjs
wasmedge-quickjs copied to clipboard
https fetch will return NotConnected Error or sometimes segmentfault
run following script multiple times sometimes cause following error. If I run it in my environment fetch my own domain, "sometimes" would transfer to "mostly". I tried upgrade rustls and tokio-rustls, no lucky. I will continue investigate this issue, but hope someone could help either.
wasmedge version 0.14.1 Darwin 22.1.0 arm64 arm build: release(debug is not ok, also)
import { fetch } from 'http'
async function test_fetch() {
try {
print('test_fetch start')
// let r = await fetch('https://httpbin.org/get?id=1')
let r = await fetch('https://httpbin.org/status/404')
print('test_fetch\n', r.status)
} catch (e) {
print(e)
}
try {
print('test_fetch start')
// let r = await fetch('https://httpbin.org/get?id=1')
let r = await fetch('https://httpbin.org/status/404')
print('test_fetch\n', r.status)
} catch (e) {
print(e)
}
try {
print('test_fetch start')
// let r = await fetch('https://httpbin.org/get?id=1')
let r = await fetch('https://google.com');
print('test_fetch\n', r.status)
} catch (e) {
print(e)
}
}
test_fetch()
following is NotConnected Error
test_fetch start
9!!!!!!
[2024-10-16T11:50:44Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:50:44Z INFO wasmedge_quickjs::event_loop] connecting to httpbin.org
[2024-10-16T11:50:44Z DEBUG rustls::client::hs] No cached session for DnsName("httpbin.org")
[2024-10-16T11:50:44Z DEBUG rustls::client::hs] Not resuming any session
[2024-10-16T11:50:45Z DEBUG rustls::client::hs] ALPN protocol is None
[2024-10-16T11:50:45Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2024-10-16T11:50:45Z DEBUG rustls::client::tls12::server_hello] Server supports tickets
[2024-10-16T11:50:45Z DEBUG rustls::client::tls12] ECDHE curve is EcParameters { curve_type: NamedCurve, named_group: secp256r1 }
[2024-10-16T11:50:45Z DEBUG rustls::client::tls12] Server DNS name is DnsName("httpbin.org")
2!!!!!
{}
test_fetch
404
test_fetch start
9!!!!!!
[2024-10-16T11:50:45Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:50:45Z INFO wasmedge_quickjs::event_loop] connecting to httpbin.org
[2024-10-16T11:50:45Z DEBUG rustls::client::hs] No cached session for DnsName("httpbin.org")
[2024-10-16T11:50:45Z DEBUG rustls::client::hs] Not resuming any session
[2024-10-16T11:50:46Z DEBUG rustls::client::hs] ALPN protocol is None
[2024-10-16T11:50:46Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2024-10-16T11:50:46Z DEBUG rustls::client::tls12::server_hello] Server supports tickets
[2024-10-16T11:50:46Z DEBUG rustls::client::tls12] ECDHE curve is EcParameters { curve_type: NamedCurve, named_group: secp256r1 }
[2024-10-16T11:50:46Z DEBUG rustls::client::tls12] Server DNS name is DnsName("httpbin.org")
2!!!!!
{}
test_fetch
404
test_fetch start
9!!!!!!
[2024-10-16T11:50:46Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:50:46Z INFO wasmedge_quickjs::event_loop] connecting to google.com
[2024-10-16T11:50:46Z DEBUG rustls::client::hs] No cached session for DnsName("google.com")
[2024-10-16T11:50:46Z DEBUG rustls::client::hs] Not resuming any session
[2024-10-16T11:50:46Z INFO wasmedge_quickjs::internal_module::wasi_net_module] async_connect return error: Os { code: 53, kind: NotConnected, message: "Socket not connected" }
Error: Socket not connected (os error 53)google.com
[2024-10-16T11:50:46Z INFO wasmedge_quickjs] Ok(Promise(JsPromise([object Promise])))
following is segfault
test_fetch start
9!!!!!!
[2024-10-16T11:55:23Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:55:23Z INFO wasmedge_quickjs::event_loop] connecting to httpbin.org
[2024-10-16T11:55:23Z DEBUG rustls::client::hs] No cached session for DnsName("httpbin.org")
[2024-10-16T11:55:23Z DEBUG rustls::client::hs] Not resuming any session
[2024-10-16T11:55:24Z DEBUG rustls::client::hs] ALPN protocol is None
[2024-10-16T11:55:24Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2024-10-16T11:55:24Z DEBUG rustls::client::tls12::server_hello] Server supports tickets
[2024-10-16T11:55:24Z DEBUG rustls::client::tls12] ECDHE curve is EcParameters { curve_type: NamedCurve, named_group: secp256r1 }
[2024-10-16T11:55:24Z DEBUG rustls::client::tls12] Server DNS name is DnsName("httpbin.org")
2!!!!!
{}
test_fetch
404
test_fetch start
9!!!!!!
[2024-10-16T11:55:24Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:55:24Z INFO wasmedge_quickjs::event_loop] connecting to httpbin.org
[2024-10-16T11:55:24Z DEBUG rustls::client::hs] No cached session for DnsName("httpbin.org")
[2024-10-16T11:55:24Z DEBUG rustls::client::hs] Not resuming any session
[2024-10-16T11:55:25Z DEBUG rustls::client::hs] ALPN protocol is None
[2024-10-16T11:55:25Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2024-10-16T11:55:25Z DEBUG rustls::client::tls12::server_hello] Server supports tickets
[2024-10-16T11:55:25Z DEBUG rustls::client::tls12] ECDHE curve is EcParameters { curve_type: NamedCurve, named_group: secp256r1 }
[2024-10-16T11:55:25Z DEBUG rustls::client::tls12] Server DNS name is DnsName("httpbin.org")
2!!!!!
{}
test_fetch
404
test_fetch start
9!!!!!!
[2024-10-16T11:55:25Z INFO wasmedge_quickjs::event_loop] falling back to webpki certs
[2024-10-16T11:55:25Z INFO wasmedge_quickjs::event_loop] connecting to google.com
[2024-10-16T11:55:25Z DEBUG rustls::client::hs] No cached session for DnsName("google.com")
[2024-10-16T11:55:25Z DEBUG rustls::client::hs] Not resuming any session
[1] 45555 bus error
Can be wrong, but if you use different versions of wasmedge-quickjs modules and wasm binary, something weird things may happen.
- https://github.com/second-state/wasmedge-quickjs/issues/144
Can be wrong, but if you use different versions of wasmedge-quickjs modules and wasm binary, something weird things may happen.
thanks for you reply. I built wasm binary and use module in the same branch.