bzr selftest (on solaris 10): too may open files
John Arbash Meinel
john at arbash-meinel.com
Thu Nov 20 16:31:54 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Voelker, Bernhard wrote:
> Vincent wrote:
...
> That means that my python installation most probably uses fopen()
> instead of open() - it is a 32-bit proggy:
>
Well, according to the earlier parts of this thread, the open handles
are sockets. And I'm pretty sure you can't open a socket with fopen.
So you are looking more for the "socket()" function:
man 2 socket
#include <sys/types.h>
#include <sys/socket.h>
int socket(int domain, int type, int protocol);
You could try exercising that by having a simple server and connecting
to it many times.
For a python example, a server could be:
import SocketServer
num_connections = 0
class MyHandler(SocketServer.BaseRequestHandler):
def handle(self):
global num_connections
num_connections += 1
print 'Got connect %d from: %s' % (num_connections,
self.client_address,)
# Read 10 bytes from the client, just to cause us to block, rather
# than close the connection right away
data = self.request.recv(10)
class ThreadedTCPServer(SocketServer.ThreadingMixIn,
SocketServer.TCPServer):
pass
server = ThreadedTCPServer(('localhost', 9999), MyHandler)
server.serve_forever()
And then as a client you could do:
import socket
sockets = []
for i in xrange(10000):
print 'opening socket %d' % (i,)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 9999))
sockets.append(sock)
for sock in sockets:
sock.send('1234567890')
sock.close()
On Windows Vista, my SocketServer gets to 1003 connections before it
actually starts failing because of:
Exception happened during processing of request from ('127.0.0.1', 56107)
Traceback (most recent call last):
File "c:\Python25\lib\SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
File "c:\Python25\lib\SocketServer.py", line 477, in process_request
t.start()
File "c:\Python25\lib\threading.py", line 440, in start
_start_new_thread(self.__bootstrap, ())
error: can't start new thread
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkklkPoACgkQJdeBCYSNAANehQCgibYwnf9b9xXfp0FbnAVOFVWZ
kbgAn3zI6iOgEcXA8Fy3QHf4c2TCZS30
=WAOP
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list