Socket read returned insufficient data

In the several months I’ve been using Mongrel, I’ve experienced two
crashes. Both were immediately following a “Socket read returned
insufficient data” error from HTTPRequest. Both times, the mongrel
process would hang indefinitely (and not respond to requests) untill
manually killed.

The first instance references a line where I was using
XML::Document.file(). It’s not clear under what
conditions the second instance occurred.

Any ideas on why this might be happening or what can be done to
prevent it?

Thanks.

Ezra Freedman

INSTANCE #1:
ERROR reading http body: Socket read returned insufficient data: 9504
/home/eperny/rails/epernicus_production/config/…/app/models/
publication.rb:72: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i486-linux]

INSTANCE #2:
Thu Feb 14 16:40:13 UTC 2008: Error reading HTTP body: #<Errno::EPIPE:
Broken pipe - /tmp/mongrel13937-1>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
http_request.rb:87:in read_body' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/ http_request.rb:55:ininitialize’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel.rb:149:in
process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel.rb:285:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:268:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
configurator.rb:282:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/ configurator.rb:281:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:128:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/ command.rb:212:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19
Thu Feb 14 16:40:14 UTC 2008: Error reading HTTP body: #<RuntimeError:
Socket read returned insufficient data: 2314>
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
http_request.rb:107:in read_socket' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/ http_request.rb:86:inread_body’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
http_request.rb:55:in initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:149:inprocess_client’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel.rb:285:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel.rb:285:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel.rb:268:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/../lib/mongrel/ configurator.rb:282:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
configurator.rb:281:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:128:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/…/lib/mongrel/
command.rb:212:in `run’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19
** TERM signal received.
Thu Feb 14 16:40:31 UTC 2008: Reaping 1 threads for slow workers
because of ‘shutdown’
Waiting for 1 requests to finish, could take 60 seconds.
Thu Feb 14 16:40:37 UTC 2008: Reaping 1 threads for slow workers
because of ‘shutdown’
Waiting for 1 requests to finish, could take 60 seconds.

Looks like it was blocking reading that external url. Possible to load
it safely before-hand or surround it with a timeout?

The first instance references a line where I was using
XML::Document.file(). It’s not clear under what
conditions the second instance occurred.