[Web-SIG] how to test hunging socket ?

William Dode wilk at flibuste.net
Fri Jan 30 22:48:04 CET 2009


On 30-01-2009, Ian Bicking wrote:
> --===============1588093401==
> Content-Type: multipart/alternative; boundary=0016364ee12abeaed40461b91b05
>
> --0016364ee12abeaed40461b91b05
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> If you use the Paste HTTP server and Python 2.5 with ctypes installed, you
> can install the watchthreads app:
> http://svn.pythonpaste.org/Paste/trunk/paste/debug/watchthreads.py
>
> that will let you see the hung threads, and get a traceback of their curren=
> t
> position.

Fine, i should definitely give it a try.

If my app is not thread safe but respond in a decent time, can i benefit 
from a multithread server (for a socket problem) if i use a lock for 
every page like that :

I use webob...

lock = Lock()
def my_application(environ, start_response):
    req = webob.Request(environ)
    res = webob.Response()
    res.content_type = 'text/html'
    try:
        lock.acquire()
        # my app...
        res.write('ok')
    finally:
        lock.release()
    return res(environ, start_response)

>
> On Fri, Jan 30, 2009 at 1:52 PM, William Dode <wilk at flibuste.net> wrote:
>
>> Hi,
>>
>> I've a problem with a web app wich freeze periodicaly. I monitored my
>> app and the hang doesn't seem to occur in it. So i think the problem is
>> before, or after, a problem of socket i imagine... It append with
>> wsgiref.simple_server and mod_wsgi. My app is not totaly thread safe so
>> i didn't try a lot of servers...
>> When it freeze, i have to restart the app manualy. With mod_wsgi it
>> freeze the whole server. It doesn't append very often so it's difficult
>> for me to reproduce the problem.
>>
>> So my question is, how can i simulate hunging socket ? or how can i see
>> where the app freeze exactly ?
>>
>> In python-paste server i read the ian tried to handle some case of
>> hunging socket...
>>
>> thx, and sorry for my english...
>>
>> --
>> William Dod=C3=A9 - http://flibuste.net
>> Informaticien Ind=C3=A9pendant
>>
>> _______________________________________________
>> Web-SIG mailing list
>> Web-SIG at python.org
>> Web SIG: http://www.python.org/sigs/web-sig
>> Unsubscribe:
>> http://mail.python.org/mailman/options/web-sig/ianb%40colorstudy.com
>>
>
>
>
> --=20
> Ian Bicking  |  http://blog.ianbicking.org
>
> --0016364ee12abeaed40461b91b05
> Content-Type: text/html; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> If you use the Paste HTTP server and Python 2.5 with ctypes installed, you =
> can install the watchthreads app: <a href=3D"http://svn.pythonpaste.org/Pas=
> te/trunk/paste/debug/watchthreads.py">http://svn.pythonpaste.org/Paste/trun=
> k/paste/debug/watchthreads.py</a><br>
><br>that will let you see the hung threads, and get a traceback of their cu=
> rrent position.<br><br><div class=3D"gmail_quote">On Fri, Jan 30, 2009 at 1=
>:52 PM, William Dode <span dir=3D"ltr">&lt;<a href=3D"mailto:wilk at flibuste.=
> net">wilk at flibuste.net</a>&gt;</span> wrote:<br>
><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
> 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
><br>
> I&#39;ve a problem with a web app wich freeze periodicaly. I monitored my<b=
> r>
> app and the hang doesn&#39;t seem to occur in it. So i think the problem is=
><br>
> before, or after, a problem of socket i imagine... It append with<br>
> wsgiref.simple_server and mod_wsgi. My app is not totaly thread safe so<br>
> i didn&#39;t try a lot of servers...<br>
> When it freeze, i have to restart the app manualy. With mod_wsgi it<br>
> freeze the whole server. It doesn&#39;t append very often so it&#39;s diffi=
> cult<br>
> for me to reproduce the problem.<br>
><br>
> So my question is, how can i simulate hunging socket ? or how can i see<br>
> where the app freeze exactly ?<br>
><br>
> In python-paste server i read the ian tried to handle some case of<br>
> hunging socket...<br>
><br>
> thx, and sorry for my english...<br>
><br>
> --<br>
> William Dod=C3=A9 - <a href=3D"http://flibuste.net" target=3D"_blank">http:=
> //flibuste.net</a><br>
> Informaticien Ind=C3=A9pendant<br>
><br>
> _______________________________________________<br>
> Web-SIG mailing list<br>
><a href=3D"mailto:Web-SIG at python.org">Web-SIG at python.org</a><br>
> Web SIG: <a href=3D"http://www.python.org/sigs/web-sig" target=3D"_blank">h=
> ttp://www.python.org/sigs/web-sig</a><br>
> Unsubscribe: <a href=3D"http://mail.python.org/mailman/options/web-sig/ianb=
> %40colorstudy.com" target=3D"_blank">http://mail.python.org/mailman/options=
> /web-sig/ianb%40colorstudy.com</a><br>
></blockquote></div><br><br clear=3D"all"><br>-- <br>Ian Bicking &nbsp;| &nb=
> sp;<a href=3D"http://blog.ianbicking.org">http://blog.ianbicking.org</a><br=
>>
>
> --0016364ee12abeaed40461b91b05--
>
> --===============1588093401==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
>
> _______________________________________________
> Web-SIG mailing list
> Web-SIG at python.org
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe: http://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org
>
> --===============1588093401==--
>


-- 
William Dodé - http://flibuste.net
Informaticien Indépendant



More information about the Web-SIG mailing list