celluloid / reel

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

Keep-Alive holds actors indefinitely. Needs a timeout. #147

Open digitalextremist opened 10 years ago

digitalextremist commented 10 years ago

Now that there is the TaskFiber.backtrace option provided by @kenichi, I've been able to pinpoint where Reel is holding open actors in pools of request handlers. It's here:

<gem path>/celluloid/lib/celluloid/io.rb:55:in `select'
<gem path>/celluloid/lib/celluloid/io.rb:55:in `wait_readable'
<gem path>/celluloid/lib/celluloid/io/stream.rb:30:in `wait_readable'
<gem path>/celluloid/lib/celluloid/io/stream.rb:43:in `sysread'
<gem path>/celluloid/lib/celluloid/io/stream.rb:41:in `sysread'
<gem path>/celluloid/lib/celluloid/io/stream.rb:392:in `synchronize'
<gem path>/celluloid/lib/celluloid/io/stream.rb:391:in `synchronize'
<gem path>/celluloid/lib/celluloid/io/stream.rb:39:in `sysread'
<gem path>/celluloid/lib/celluloid/io/stream.rb:129:in `readpartial'
<gem path>/reel/lib/reel/request/parser.rb:53:in `readpartial'
<gem path>/reel/lib/reel/request/parser.rb:47:in `current_request'
<gem path>/reel/lib/reel/connection.rb:57:in `request'
<gem path>/reel/lib/reel/connection.rb:78:in `each_request'

This is likely an issue with Celluloid::IO streams, but it is most felt in Reel I believe.

There needs to be the ability to provide a timeout so it eventually lets go of the socket, and releases actors handling requests back to their pool.

tarcieri commented 10 years ago

See this thread for discussion of timeouts:

https://groups.google.com/forum/#!topic/celluloid-ruby/u35U3yUhTw0

tl;dr: all the prerequisites are there (and have been there for awhile), but getting everything wired up correctly has been an ongoing struggle

digitalextremist commented 10 years ago

Thanks for the reference @tarcieri. I will move over to this after celluloid/celluloid#406 if it's not resolved by the time I finish that. It's critical path for me, so it'll be no problem to come in on it and help land this.