bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
670 stars 133 forks source link

crashes when too many requests #44

Closed emretulek closed 11 months ago

emretulek commented 1 year ago

I get a crash error when I make too many synchronous requests with nodejs. When I send requests at 100ms intervals, it gives an error after a short while.

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0000005DD19FE0D0
 1: 00007FF7FAECB1EF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+123599
 2: 00007FF7FADE7E7F std::basic_ostream<char,std::char_traits<char> >::operator<<+65407
 3: 00007FF7FBAC4482 V8_Fatal+162
 4: 00007FF7FB52EC6D v8::internal::BackingStore::Reallocate+637
 5: 00007FF7FB7781D9 v8::ArrayBuffer::GetBackingStore+137
 6: 00007FF7FAE9AD29 napi_get_typedarray_info+393
 7: 00007FFE71348828
 8: 00007FFE71347C19
 9: 00007FFE7134D003
10: 00007FFE7134ED79
11: 00007FFE7134DD09
12: 00007FFE7134949E
13: 00007FFE713480B7
14: 00007FFE7134EF63
15: 00007FF7FAE954EB node::Stop+32747
16: 00007FF7FB746BE6 v8::internal::Builtins::code_handle+172806
17: 00007FF7FB7467D9 v8::internal::Builtins::code_handle+171769
18: 00007FF7FB746A9C v8::internal::Builtins::code_handle+172476
19: 00007FF7FB746900 v8::internal::Builtins::code_handle+172064
20: 00007FF7FB819FE1 v8::internal::SetupIsolateDelegate::SetupHeap+494641
21: 000001D623F3D2BB
bogdanfinn commented 1 year ago

@emretulek can you maybe provide code to replicate your issue?

emretulek commented 1 year ago

I am adding some standard browser headers. Let me also point out that I am using a proxy.

I had no problems when I didn't use tlsClientLibrary.freeMemory(responseObject.id).


const requestPayloadDefault = {
    "tlsClientIdentifier": "chrome_105",
    "followRedirects": false,
    "insecureSkipVerify": false,
    "withoutCookieJar": false,
    "withDefaultCookieJar": false,
    "isByteRequest": false,
    "catchPanics": false,
    "additionalDecode": null,
    "withDebug": false,
    "forceHttp1": false,
    "withRandomTLSExtensionOrder": true,
    "timeoutSeconds": 30,
    "timeoutMilliseconds": 0,
    "sessionId": "my-session-id",
    "proxyUrl": "",
    "isRotatingProxy": false,
    "certificatePinningHosts": {},
    "headers": {},
    "headerOrder": [
        "accept",
        "user-agent",
        "accept-encoding",
        "accept-language"
    ],
    "requestUrl": "",
    "requestMethod": "GET",
    "requestBody": "",
    "requestCookies": []
}
    requestPayload.requestUrl = url;
    requestPayload.requestMethod = "GET";
    requestPayload.proxyUrl = 'http://' + options.proxy.host + ':' + options.proxy.port;
    requestPayload.headers = {
       //some headers
    }

    return await new Promise((resolve, reject) => {
        tlsClientLibrary.request.async(JSON.stringify(requestPayload), (err, response) => {
            resolve(JSON.parse(response))
        });
    }).then((response) => {
        return response;
    });
emretulek commented 1 year ago

Although not very often, I see the following errors in my logs, let me state that I am using a proxy again.

failed to do request: Post "https://xxxxxxxx.xxx": unexpected EOF failed to do request: Post "https://xxxxxxxx.xxx": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

bogdanfinn commented 1 year ago

@emretulek please take a look at: https://github.com/bogdanfinn/tls-client/issues/53#issuecomment-1594838052

bogdanfinn commented 11 months ago

Closed due to inactivity