Skip to content
Browse files

Handle more errors trying to read client data. Fixes #138

  • Loading branch information...
1 parent f50acd2 commit b2550acfaf35c9b72b960c68c44c7d1c52d32c58 @evanphx evanphx committed Aug 27, 2012
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/puma/reactor.rb
View
20 lib/puma/reactor.rb
@@ -12,10 +12,12 @@ def initialize(server, app_pool)
@input = []
@sleep_for = DefaultSleepFor
@timeouts = []
+
+ @sockets = [@ready]
end
def run
- sockets = [@ready]
+ sockets = @sockets
while true
ready = IO.select sockets, nil, nil, @sleep_for
@@ -53,7 +55,7 @@ def run
@events.parse_error @server, c.env, e
- rescue IOError => e
+ rescue StandardError => e
c.close
sockets.delete c
end
@@ -79,12 +81,14 @@ def run
def run_in_thread
@thread = Thread.new {
- begin
- run
- rescue Exception => e
- puts "MAJOR ERROR DETECTED"
- p e
- puts e.backtrace
+ while true
+ begin
+ run
+ break
+ rescue StandardError => e
+ STDERR.puts "Error in reactor loop escaped: #{e.message} (#{e.class})"
+ puts e.backtrace
+ end
end
}
end

0 comments on commit b2550ac

Please sign in to comment.
Something went wrong with that request. Please try again.