celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

re-submitting #162 with updated specs #163

Closed Mask closed 9 years ago

Mask commented 9 years ago

previous PR didn't include the migration to new rspec

tarcieri commented 9 years ago

I get the following failure on this test on OS X:

  1) Reel::Connection resets if client dropped connection
     Failure/Error: connection.respond :ok, ("Some Big Response sent"*100000)
     Errno::EPROTOTYPE:
       Protocol wrong type for socket
     # ./lib/reel/response/writer.rb:31:in `write'
Mask commented 9 years ago

Interesting - I'm developing with MRI 2.0.0p481 on OSX 10.9.5 and can't reproduce this. With which ruby does this happen?

tarcieri commented 9 years ago

Originally 2.2.0, but I get it with 2.0.0-p451 as well

Mask commented 9 years ago

are you using Yosemite by any chance? We could be running into this: http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ TL;DR: Apple changed the call to send() in OSX 10.10 - it can now return EPROTOTYPE if you try to write to a socket which is closing.

tarcieri commented 9 years ago

I am indeed using Yosemite

Mask commented 9 years ago

Ok, I took this as an opportunity/excuse to update to Yosemite and can now reproduce this. If only happens maybe 20% of the time, so there's a race condition in there somewhere. Anyway, including EPROTOTYPE in the exception list seems to help.

BTW: this is actually completely unrelated to the original topic #150, which was a celluloid/reel state problem. It's a pure coincidence that the additional test happened to uncover this issue with yosemite.

Mask commented 9 years ago

(hit wrong button)

Mask commented 9 years ago

I was wondering why other ruby-based servers aren't haveing this problem, so I looked into the puma sources. They simply catch

rescue Errno::EPIPE, SystemCallError, IOError

An unexpected EPROTOTYPE will be handled as a generic SystemCallError - should we do this too? What do you think?

kenichi commented 9 years ago

:+1: