Danny-Dasilva/CycleTLS

Could not connect to the CycleTLS instance within 4000ms

ElrY2 opened this issue · 6 comments

ElrY2 commented

Description

when i tried a site to get the data after 30 check i got this error

Could not connect to the CycleTLS instance within 4000ms

Issue Type

Bug

Operating System

Windows 10

Node Version

Other

Golang Version

None

Relevant Log Output

Could not connect to the CycleTLS instance within 4000ms

As a general solution I would suggest increasing the request timeout. Could you provide me a minimal example so I can reproduce the error?

As a general solution I would suggest increasing the request timeout. Could you provide me a minimal example so I can reproduce the error?

if his issue was anything like mine, just using bun.sh causes this. increasing the timeout has no effect and you end up orphaning a server process on port 9119.

this was running the example from the README:

const initCycleTLS = require('cycletls');
// Typescript: import initCycleTLS from 'cycletls';

(async () => {
  // Initiate CycleTLS
  const cycleTLS = await initCycleTLS();

  // Send request
  const response = await cycleTLS('https://ja3er.com/json', {
    body: '',
    ja3: '771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0',
    userAgent: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0',
    proxy: 'http://username:password@hostname.com:443', 
  }, 'get');

  console.log(response);

  // Cleanly exit CycleTLS
  cycleTLS.exit();

})();

Process then hangs there, pressing ctrl-c yields:

error: Could not connect to the CycleTLS instance within 4000ms
^C58 |     }
59 |     else {
60 |         if (child) {
61 |             // For Linux/Darwin OS
62 |             await new Promise((resolve, reject) => {
63 |                 process.kill(-child.pid);
                     ^
RangeError: pid must be a positive integer

after which you gotta use other means of finding and killing that pid if just running from the terminal. lsof -i :9119 or top works alright.

Edit: changing that line to process.kill(child.pid) makes it so ctrl-c kills the process, but timeout issue persists with bun.

I have the same problem whern runing ctyle for request for a long time

same here, I run about 900 requests/minutes. After about 10 minutes, CycleTLS seems to be non-responsive where all requests are timed out with status 408.

Sometimes it won't even give any response and just hangs at the await CycleTLS(...) even when I have "timeout" set.

I tried to use a function to timeout the promise, but when the bug happens, CycleTLS will just timeout(via my timeout function) everytime and not give any responses.

I also tried to CycleTLS.exit() and cycleTLS = await initCycleTLS(); again. still the same continues timeout.

Has anyone found a fix for this? It's a very serious bug that makes CycleTLS practically unusable