Skip to content

https fetch will return NotConnected Error or sometimes segmentfault #144

@denghongcai

Description

@denghongcai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions