Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#19 No FD Cleanup when server BIND error

closed
nobody
None
5
2001-06-21
2001-06-06
No

When you do a "server.bindAndListen()", if the port is
used, the object raises an error. Fine. But the object
keeps a FD, and it doesn't clean the FP up.

Usually this is not an issue, since when we garbage
collect the object or the object is reused, the FD is
cleaned up. But if the server object is "leaked" (for
example, we keep references for any reason), the FD is
also leaked.

If you have only a server object, this is a non issue.
But if you work with a lot of server objects, this is a
risk.

Check:

>>> import xmlrpc
>>> a=[]
>>> for i in range(50) :
... b=xmlrpc.server()
... try :
... b=xmlrpc.bindAndListen(80) # Use a locally
"already" used port
... except :
... pass
... a.append(b)
...
(here we keep 50 server objects around)
>>> b=open("/etc/passwd")
>>> b.fileno()
53 <- The server objects keeps the FD around

Discussion

  • Shilad Sen
    Shilad Sen
    2001-06-07

    • status: open --> closed
     
  • Shilad Sen
    Shilad Sen
    2001-06-07

    Logged In: YES
    user_id=184164

    fixed in 0.8.6

     
    • status: closed --> open
     
  • Logged In: YES
    user_id=97460

    I see the very same error in 0.8.6. Please, execute the code
    I posted and see yourself.

     
  • Shilad Sen
    Shilad Sen
    2001-06-21

    • status: open --> closed
     
  • Shilad Sen
    Shilad Sen
    2001-06-21

    Logged In: YES
    user_id=184164

    Sorry about the mix-up. I really have fixed this in 0.8.7