Coder Social home page Coder Social logo

node-socket-hang-up-bug's Introduction

Bug Summary: Axios Connection Pooling Misconception

Issue

Axios relies on nodes HTTP/HTTPS agent for connection pooling rather than implementing its own. Consequently, Axios "instances" are not truly isolated; they serve primarily to set default configurations for HTTP requests. This misunderstanding leads to unexpected behavior when different timeouts are set for requests on what is assumed to be isolated instances.

TCP trace

Trace Analysis

The TCP trace shows that with HTTP keep-alive, requests GET /1 and GET /wait are transmitted over a single TCP connection. The initial request is configured with a 1-second timeout, followed by a request with no timeout. The re-use of the connection for both requests causes the second request to be prematurely terminated at the 1-second mark, despite the server still processing the request.

Recommendation

Utilise a consistent Axios instance for all requests to a specific server. This instance should be defined once, preferably at the module level, to avoid the repeated instantiation of Axios instances that can lead to unexpected timeouts due to shared underlying connections.

node-socket-hang-up-bug's People

Contributors

snarky-puppy avatar

Stargazers

Duc Nguyen - eBenefits avatar

Watchers

 avatar

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.