On Sat, 2011-04-23 at 10:54 +0200, Moritz Schlarb wrote:
We're using pysmbc in a project where we have a file crawler that
crawls
some hundreds of samba servers.
I recently noticed, that when this crawler runs (with a worker pool of
10 processes), it - of course - opens lots of connections to the servers
it is supposed to crawl but doesn't close them afterwards!
So the established connections cumulate when I watch it with netstat -t
on the crawling machine.
This behaviour stays the same, when I say
c = smbc.Context()
#crawl
del c
I can't reproduce this. Using this small test program, I let it run for
a minute or so and then examined its open file descriptors: there were
none, other than stdin/stdout/stderr.
#!/usr/bin/python
import smbc
while True:
c = smbc.Context ()
del c
$ ls -l /proc/26855/fd
total 0
lrwx------. 1 twaugh twaugh 64 May 18 13:27 0 -> /dev/pts/0
lrwx------. 1 twaugh twaugh 64 May 18 13:27 1 -> /dev/pts/0
lrwx------. 1 twaugh twaugh 64 May 18 13:26 2 -> /dev/pts/0
In other words, no sockets are opened simply for creating a context.
It's entirely possible there is a leak somewhere in pysmbc, but I can't
spot it.
Perhaps you could watch the network traffic using a tool such as
wireshark, and see which connections are left open and what they were
for.
Tim.
*/