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

https fetch will return NotConnected Error or sometimes segmentfault #144

Open
denghongcai opened this issue Oct 16, 2024 · 2 comments
Open

Comments

@denghongcai
Copy link
Contributor

denghongcai commented Oct 16, 2024

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
@hiroshi
Copy link

hiroshi commented Oct 16, 2024

Can be wrong, but if you use different versions of wasmedge-quickjs modules and wasm binary, something weird things may happen.

@denghongcai
Copy link
Contributor Author

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.

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

No branches or pull requests

2 participants