We had a similar issue, upgrading from 0.8 to 0.10, but the root cause was
muddied by upgrades to modules as well.
The issue occurred in our test suite, only when we ran a "large" number of
tests. Running each test suite independently did not repro the error.
In the end, here's how we fixed the issue:
Analysis:
- Ran wireshark during a faulty test run, our tests issued HTTP requests to
a local node server
- Checked the wireshark trace and noticed
- a RST getting sent just before the test failure
- many, many, many different port numbers being used for issuing the
requests
Test hypothesis:
The variety of different ports being used in the trace led us to believe we
had too many fd open
- we ran a counter on the number of requests made in our tests, and they
would fail when we hit roughly the 250 mark
- we bumped up the fd limit locally, and ran the tests again, and they'd
pass
Fix:
We used mocha and supertest to issue these requests, and realized that we
were actually spinning up new port bindings on every request instead of
reusing existing bindings.
So code that was written like so:
var request = require('supertest');
var app = require('../app');
request(app).get(...);
request(app).get(...);
Became
var request = require('supertest');
var app = require('../app');
var supertest = request(app);
supertest.get(...);
supertest.get(...);
That solved the issue for us.
In summary, during the upgrade, we ended up using many more file
descriptors than we'd anticipate due to our test setup, and the OS started
killing them causing the RST to get sent. We fixed up our tests and haven't
seen the RST since.
On Tuesday, July 2, 2013 1:38:09 PM UTC-4, Sam Roberts wrote:
>
> On Sun, Jun 30, 2013 at 11:35 AM, Jonahss <[email protected] <javascript:>>
> wrote:
> >> I know this error was previously ignored before 0.10, but I'd like to
> know
> >> what's causing this and how I can fix it/debug it?
> >> Is it a problem on our end (server) closing connections too soon?
>
> Wireshark the connection, its usually pretty obvious what about the
> TCP exchange pattern is causing a reset when you see the packets.
>
> One common cause is timing, the server might be doing a close()
> instead of a shutdown(WRITE) (.end() in node), and the clients data
> arrives after the close sometimes, and before at other times. If its
> after, the connection is reset by the stack. Small changes in ordering
> of operations (node's write of buffers, o/s scheduling when client and
> server are running on the same system, system load, etc. can cause
> what is essentially a bug in the use of TCP to appear or go away).
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.