I've written a servlet using webrick.  I've written it badly. Some
exceptions (particularly those relating to missing methods or missing
variables) causes the servlet thread to consume ever larger amounts of
memory and not return anything.  Turning on tracer shows me that after
the exception is thrown the webrick thread gets stuck, performing this
for ever:

....
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:<:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:<:        
"#{arg.class}: #{arg.message}\n\t" <<
.....

I can fix the underlying error. But does anyone have any thoughts as
to what I might have done wrong to cause these exceptions to jam
webrick up? (I've put the bit leading up to the error below)

Many thanks

Tom

(running ruby 1.8.1 (2003-12-25) [powerpc-darwin])

#2:soks2.rb:516:NameError:>:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:NameError:<:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:Exception:>:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:Exception:<:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:Exception:>:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:Exception:<:            @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:WikiServlet::           @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:516:Kernel:<:               @wiki.revise( pagename,
upload( "attachment/#{request.query['file'].filename}",
request.query['file'] ) , author, @wiki.content_type( pagename ) )
#2:soks2.rb:488:WikiServlet:<:          self.send( verb , request,
response, pagename, request.user)
#2:soks2.rb:488:Kernel:<:               self.send( verb , request,
response, pagename, request.user)
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:54:WikiServlet:<:    
      service(req, res)
#2:/opt/local/lib/ruby/1.8/webrick/server.rb:150:WEBrick::HTTPServer:<:
          block ? block.call(sock) : run(sock)
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:55:Module:>:        
rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:55:Module:<:        
rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:55:Module:>:        
rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:55:Module:<:        
rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:57:Module:>:        
rescue HTTPStatus::Error => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:57:Module:<:        
rescue HTTPStatus::Error => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:59:Module:>:        
rescue HTTPStatus::Status => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:59:Module:<:        
rescue HTTPStatus::Status => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:61:Module:>:        
rescue StandardError => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:61:Module:<:        
rescue StandardError => ex
#2:/opt/local/lib/ruby/1.8/webrick/httpserver.rb:62:WEBrick::HTTPServer:-:
          @logger.error(ex)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:49:WEBrick::BasicLog:>:    
def error(msg) log(ERROR, "ERROR " << format(msg)); end
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:49:WEBrick::BasicLog:-:    
def error(msg) log(ERROR, "ERROR " << format(msg)); end
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:62:WEBrick::BasicLog:>:    
def format(arg)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:63:WEBrick::BasicLog:-:     
 str = if arg.is_a?(Exception)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:63:WEBrick::BasicLog:-:     
 str = if arg.is_a?(Exception)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:63:Kernel:>:       str = if
arg.is_a?(Exception)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:63:Kernel:<:       str = if
arg.is_a?(Exception)
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:65:WEBrick::BasicLog:-:     
   arg.backtrace.join("\n\t") << "\n"
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Kernel:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Kernel:<:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Module:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Module:<:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Exception:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:NameError:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Kernel:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Kernel:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:>:        
"#{arg.class}: #{arg.message}\n\t" <<
#2:/opt/local/lib/ruby/1.8/webrick/log.rb:64:Fixnum:<:        
"#{arg.class}: #{arg.message}\n\t" <<