Progress.

reverting this change makes the problem go away:

http://code.google.com/p/web2py/source/diff?spec=svn9619eb054669ed5931f65f8815731f4c52857c5d&r=9619eb054669ed5931f65f8815731f4c52857c5d&format=side&path=/gluon/widget.py

The problem is that the socket timeout was increased from 1 to 60 so
that the web server does not close connections with slow clients.
Somehow CTRL-C gets queued until the 60 seconds expire.

Massimo

On Jan 30, 5:01 pm, Ricardo Pedroso <rmdpedr...@gmail.com> wrote:
> On Sun, Jan 29, 2012 at 5:28 PM, Ricardo Pedroso <rmdpedr...@gmail.com> wrote:
> > On Sun, Jan 29, 2012 at 4:27 PM, Massimo Di Pierro
> > <massimo.dipie...@gmail.com> wrote:
>
> >> I used to be able to stop the server with CRTL+C but it does not work
> >> anymore on my mac. I now have to kill it. Why?
>
> > I'm new to web2py, but I already see this happened
> > in other scripts when working with sockets and threads.
>
> I've been analyzing this issue and I think I've found the problem
> I think the problem could be with HTTP/1.1 keep_alive feature.
>
> How to test:
> 1. In a console start web2py:
> $ ./web2py
>
> 2. In other console start a telnet connection to web2py:
> $ telnet 127.0.0.1 8000
> GET / HTTP/1.1<CR>
> Host: 127.0.0.1:8000<CR>
> Connection: keep-alive<CR>
> <CR>
>
> After this last <CR>, telnet session doesn't quit.
>
> Now in the other console stop web2py with CTRL-C
> it will hand, but if you kill the telnet web2py quit immediately.
>
> This test can be done with a browser also:
> Just run one and only one browser instance and gotohttp://127.0.0.1:8000
> Then CTRL-C web2py, it will hang
> Close your browser and web2py quits immediately
>
> web2py after some time eventually quits, the socket will timeout, I'm not
> sure but this timeout is the default from the OS.
>
> web2py is hanging in the thread join in rocket.py around line 1066 in
> the stop method.
>
> This was not easy for me to explain but I hope that I gave some more
> leads to this issue.
>
> Ricardo

Reply via email to