Matt Blair

Matt Blair

I read that you learn more from a poor example than from a correct one. I don't believe this but that means my site will be a success.

Superagent/Request Memory Leaks

Superagent/Request Memory Leaks

1-Minute Read

Superagent/Request Memory Leaks

The last several weeks Thomas Hunter and myself have spent some of our nights and weekends trying to track down memory leaks in an API we both work on.

We were seeing a distinct pattern, that when the API was put under a certain amount of load, that we would start slowly bleeding memory.

We’ve found three results:

  • Superagent, when put under a certain threshold of load and then connections timeout, can leak memory.

  • Request, when put under a certain threshold of load and then connections timeout, can leak memory.

  • Superagent, when not explicitly assigned a timeout parameter, can hold connections open and therefore leak memory

    • The fix for this is to call req.timeout(YOUR_TIMEOUT_VALUE) to resolve.

The fixes for these issues are all in the latest versions of the libraries

Recent Posts

Categories

About

This theme was developed for Hugo.