[erlang-bugs] SSL socket gets closed abruptly

Loïc Hoguin essen@REDACTED
Thu Feb 6 17:34:28 CET 2014


Hello,

I had the weirdest experience today. Let me describe it.

I added a test to the Cowboy test suite. That test sends more or less 
19MB of data to the server, which replies with 200 OK and no body.

The test worked for HTTP, but not for HTTPS (and similarly, worked with 
HTTP + reply compression but not HTTPS + reply compression).

Instead of getting a response, the test received {error, closed}.

Here is where it starts to get interesting:

Changing the reponse status code from 200 to anything else made the 
response be sent successfully. Everything other than 200 that I tried 
worked. But sending 200 was leading to the socket being closed before 
anything got sent.

On the other hand, on the Cowboy side of things, everything looked like 
it was sent. No errors or anything. And adding a few timer:sleep here 
and there didn't change a thing, it was still failing.

So I tried changing which tests were ran and reduced their number. Below 
a certain number of tests ran in parallel the test passed. Above a 
certain number the test failed. Running the tests sequential made the 
test succeed.

Then another weird thing. Removing the test that reads from /dev/urandom 
made the failing test succeed. But leaving only these 2 tests in made 
the test pass successfully.

I continued to investigate and tried all Erlang versions from R15B01 to 
master. The failure occurred only from R16B onward.

Then I tried a few other things (see previous mail) but for some reason 
the failure doesn't occur anymore. I cannot reproduce my previous issue.

I do not know what the issue was. Perhaps cosmic rays. I did not try 
going into a bunker to see if it happened there too. But I figured you 
might have a clue about it and potentially figure out a very weird bug 
in the SSL code.

Since my issue magically fixed itself I can continue with my work, at least.

Enjoy!

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-bugs mailing list