Danny-Dasilva / CycleTLS

Spoof TLS/JA3 fingerprints in GO and Javascript
GNU General Public License v3.0
893 stars 169 forks source link

Could not connect to the CycleTLS instance within 4000ms #295

Open ElrY2 opened 9 months ago

ElrY2 commented 9 months ago

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
Danny-Dasilva commented 9 months ago

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

heyfixit commented 9 months ago

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.

youxiaohou commented 9 months ago

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

GiveDaData commented 7 months ago

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.

svinc33 commented 6 months ago

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

3lang3 commented 1 month ago

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.

I had the same problem, which worked well at first and started to be unresponsive after about ten minutes

Have you found a solution now?