Git Product home page Git Product logo

Comments (13)

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024 1

Error: listen EADDRINUSE: address already in use :::9119 happens because you are calling initCycleTLS(); multiple times (remember this is not necessary because anything passed to the first instance created will be handled by the internal Golang queue).

if you want to do this you need to pass a different port to it e.g. const cycleTLS = await initCycleTLS({port: 9118}); or some port other than 9119

from cycletls.

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024

CycleTLS has an internal worker queue system. You don't need to close the connection or call cycleTLS.exit(); after each call. If you want to cleanly exit at the end you can use Promise.all() like in the example in the docs.

I would say for repeated requests you can just not call exit and this error should no longer appear.

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

CycleTLS has an internal worker queue system. You don't need to close the connection or call cycleTLS.exit(); after each call. If you want to cleanly exit at the end you can use Promise.all() like in the example in the docs.

I would say for repeated requests you can just not call exit and this error should no longer appear.

I am using CycleTLS asynchronously.

from cycletls.

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024

Right, CycleTLS has an Asynchronous internal worker queue system.
This means asynchronicity is actually handled on the Golang side regardless of the JS implementation.
If you make sequential calls to CycleTLS the requests will be processed asynchronously and returned as soon as Golang processes the request.

as an example of this

const initCycleTLS = require("cycletls");

(async () => {
    const cycleTLS = await initCycleTLS();
  
      let response = cycleTLS('http://httpbin.org/delay/2', {
        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: ''
      });

      response.then((out) => {
        console.log(out) //Will always console.log second because of the delay
      })
      response = cycleTLS('http://httpbin.org/user-agent', {
        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: ''
      });
  
      response.then((out) => {
        console.log(out) //will console.log first because the request time is faster
      })
  
  })();

You will notice that the delay/2 response will always log to the console second even though it is called first. This means that CycleTLS responses are always returned as soon as they are processed regardless of the order they are called in. Unless of course they are awaited.

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

Right, CycleTLS has an Asynchronous internal worker queue system.
This means asynchronicity is actually handled on the Golang side regardless of the JS implementation.
If you make sequential calls to CycleTLS the requests will be processed asynchronously and returned as soon as Golang processes the request.

as an example of this

const initCycleTLS = require("cycletls");

(async () => {
    const cycleTLS = await initCycleTLS();
  
      let response = cycleTLS('http://httpbin.org/delay/2', {
        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: ''
      });

      response.then((out) => {
        console.log(out) //Will always console.log second because of the delay
      })
      response = cycleTLS('http://httpbin.org/user-agent', {
        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: ''
      });
  
      response.then((out) => {
        console.log(out) //will console.log first because the request time is faster
      })
  
  })();

You will notice that the delay/2 response will always log to the console second even though it is called first. This means that CycleTLS responses are always returned as soon as they are processed regardless of the order they are called in. Unless of course they are awaited.

So what do you think is causing this Socket error?

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

CycleTLS has an internal worker queue system. You don't need to close the connection or call cycleTLS.exit(); after each call. If you want to cleanly exit at the end you can use Promise.all() like in the example in the docs.

I would say for repeated requests you can just not call exit and this error should no longer appear.

This did help the error occurs less but it did occur after about 45 mins of continuous calls.

from cycletls.

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024

Got it, yeah then there's a bug, something is killing the web socket connection without cleanly exiting internally. If you could provide some code that reliably reproduces this I can investigate.

Under the issues tab there's a template for bug reporting. If you could provide the information requested in the markdown template that could help as well.

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

Got it, yeah then there's a bug, something is killing the web socket connection without cleanly exiting internally. If you could provide some code that reliably reproduces this I can investigate.

Under the issues tab there's a template for bug reporting. If you could provide the information requested in the markdown template that could help as well.

I will upload some code shortly that accurately shows you what I am trying to accomplish but another error I get when I take away cycletls.exit() altogether is this error: Error: listen EADDRINUSE: address already in use :::9119.

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

Error: listen EADDRINUSE: address already in use :::9119 happens because you are calling initCycleTLS(); multiple times (remember this is not necessary because anything passed to the first instance created will be handled by the internal Golang queue).

if you want to do this you need to pass a different port to it e.g. const cycleTLS = await initCycleTLS({port: 9118}); or some port other than 9119

Thank for the support! Great module you have here!

from cycletls.

dracoDevs avatar dracoDevs commented on May 25, 2024

Error: listen EADDRINUSE: address already in use :::9119 happens because you are calling initCycleTLS(); multiple times (remember this is not necessary because anything passed to the first instance created will be handled by the internal Golang queue).

if you want to do this you need to pass a different port to it e.g. const cycleTLS = await initCycleTLS({port: 9118}); or some port other than 9119

Now I get a new error after some time Error: panic: runtime error: invalid memory address or nil pointer dereference.

from cycletls.

Stephen-PP avatar Stephen-PP commented on May 25, 2024

code?

from cycletls.

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024

This may be related to this Ja3 Token Parsing error but I cannot bugfix something I can't reproduce.

from cycletls.

Danny-Dasilva avatar Danny-Dasilva commented on May 25, 2024

Addressed by this PR. Feel free to open another issue if you experience errors.

from cycletls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.