Message73777
The garbage collector does collect unreachable objects.
What happens is that with python 2, the socket is explicitly closed by
the HTTPServer, whereas with python 3, the explicit close() does not
work, and the socket is ultimately closed when the request has finished
and all objects are disposed.
The cause is in the socket.makefile() function: since python3, the
underlying socket uses a reference count, so that:
s = <a connected socket>
f = s.makefile()
s.close()
does not close the socket! adding f.close() is not enough. A "del f" is
necessary to really close the underlying socket. |
|
Date |
User |
Action |
Args |
2008-09-25 11:51:42 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, gregory.p.smith, ggenellina, zanella, romkyns |
2008-09-25 11:51:42 | amaury.forgeotdarc | set | messageid: <1222343502.14.0.299847177005.issue3826@psf.upfronthosting.co.za> |
2008-09-25 11:51:40 | amaury.forgeotdarc | link | issue3826 messages |
2008-09-25 11:51:39 | amaury.forgeotdarc | create | |
|