When I run a ruby script that uses webrick, it seems to hang on exit.
I'm using ruby 1.8.2 on Windows XP. (I don't remember having this
sort of problem using linux, but I don't have a machine here to verify
that.)
For example, if I run the following:
require 'webrick'
server = WEBrick::HTTPServer.new(
:Port => 8081,
:DocumentRoot => '.'
)
> Try disabling keep-alive, (either in your HTML head section, or using
> raw headers in your servlets) and see if the process shuts down
> normally.
I'll give that a go, although interestingly it'll hang even if it has never served a single item. Simply starting the script and then trying to terminate it right away will make it hang.
Just to follow up... I checked on my home machines (one Linux, one Max
OS X) and they were both fine using that same piece of sample code.
So it definately just seems to be Windows. (Or perhaps it's just *my*
Windows machine
It's annoying though, as it really slows down the edit/test cycle...
if the issue here is that you are shutting down webrick frequently because
you are developing and want to test then you can feed :auto_reload =>
true to webrick's option hash.
it will auto-reload all the classes on each request.
marcel
···
On Tue, Sep 21, 2004 at 01:59:37PM +0900, Kevin M wrote:
Just to follow up... I checked on my home machines (one Linux, one Max
OS X) and they were both fine using that same piece of sample code.
So it definately just seems to be Windows. (Or perhaps it's just *my*
Windows machine
It's annoying though, as it really slows down the edit/test cycle...
if the issue here is that you are shutting down webrick frequently because
you are developing and want to test then you can feed :auto_reload =>
true to webrick's option hash.
Cool, that sounds like exactly what I need to work around the problem.
Later, when I have some more time, I'll see if I can find the cause of the hanging.
Cool, thanks, that does the trick. I guess WEBrick must leave a thread stuck blocking on a socket call, and the raise breaks it out of the block. Or something like that. Either way, this fixes it, which is good enough for me