bugsnag/bugsnag-node — pull request #17 by ConradIrwin (2013-10-23 16:48:14+00:00)
Title: Fix express middleware stack overflow bug

There seems to be a bug, either in express, or more probably in node
itself that causes a stack overflow error when a domain has a request
object on it (I think this is because there's a socket on the request
object, but I've not verified it).

When I tried running the code on node v11.7 (which apparently has
stacktraces for stack overflow errors) I couldn't replicate the bug.

A workaround seems to be to simply read the data off the request ahead
of time and storing that in the request, so I've done that.

To test this I created a simple express app that had two routes, one
fast that I hammered from localhost, and one slow that I uploaded a
large file to over a slow network (taking about 10s). The 10s uploads
crash approximately 1/3rd of the time before this change; after this
change, I've run nearly a hundred requests without a single crash.