On Nov 13, 2006, at 12:52 PM, Aïssa HAMMOUCHI wrote:
> i'm trying to make working a connection pooling in my app
> (i'm using mod_scgi/apache/quixote/durus)
>
> the firsts 40 requests (i call db to get one object) get a
> traceback, then tracebacks disappear after this occured.
> if i stop my app and restart durus/scgi and launch 200 requests
> with a load test tool, i get the same scenario after that 40 or
> more requests are done, tracebacks disappear and the next requests
> work fine with no tracebacks..
The number 40 happens to be the value given as the argument to the
call to the socket listen() method in
SocketAddress.get_listening_socket().
I wonder if changing that number changes the number of tracebacks you
see on the initial burst.
>
> what's wrong ?
>
> ######################################################################
> ######
> import Queue
> class Pooler:
> def __init__(self):
> self.q = Queue.Queue()
> for i in xrange(30):
> self.q.put( Connection(ClientStorage(host='
> 127.0.0.1',port=15000))
>
> def get(self):
> return self.q.get()
>
> def put(self,c):
> c.abort()
> self.q.put(c)
>
>
> _pool = Pooler()
>
> class MySession(Session):
> def __init__(self, id):
> Session.__init__(self, id)
> self.pooler = _pool
> self.objects = None
> user = User()
> user.set_name('Anonymous-'+generate_str(5,int))
> self.user = user
> ....
>
> .....
>
> ######################################################################
> ###
>
> [2006-11-13 19:53:31] exception caught
> Traceback (most recent call last):
> File "/home/ah/src/alternate-modules/quixote/publish.py", line
> 278, in process_request
> output = self.try_publish(request)
> File "/home/ah/src/alternate-modules/quixote/publish.py", line
> 253, in try_publish
> output = self.root_directory._q_traverse(components)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 63, in _q_traverse
> return obj._q_traverse(path)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 63, in _q_traverse
> return obj._q_traverse(path)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 57, in _q_traverse
> obj = self._q_lookup(component)
> File "/home/ah/pymods/fidji/ui/browse.ptl", line 122, in _q_lookup
> body(menu(), list_doc())
> File "/home/ah/pymods/fidji/ui/browse.ptl", line 117, in list_doc
> "
%s
"%(i.id,i.nom)
> File "/home/ah/src/alternate-modules/durus/persistent.py", line
> 92, in __getattribute__
> self._p_load_state()
> File "/home/ah/src/alternate-modules/durus/persistent.py", line
> 135, in _p_load_state
> self._p_connection.load_state(self)
> File "/home/ah/src/alternate-modules/durus/connection.py", line
> 185, in load_state
> pickle = self.get_stored_pickle(oid)
> File "/home/ah/src/alternate-modules/durus/connection.py", line
> 105, in get_stored_pickle
> record = self.storage.load(oid)
> File "/home/ah/src/alternate-modules/durus/client_storage.py",
> line 43, in load
> return self._get_load_response(oid)
> File "/home/ah/src/alternate-modules/durus/client_storage.py",
> line 54, in _get_load_response
> raise ProtocolError('status=%r, oid=%r' % (status, oid))
> ProtocolError: status='t', oid='\x00\x00\x00\x00\x00\x00\x02\xf9'
The client asked for object record for this "i" object.
It expects one of three status codes as a reply, and
it got 't', which is not one of them. This indicates that
before the load command, the server had sent data that,
for some reason, had never been read by the client.
It seems likely that you have two threads using the same connection
in a non-serialized way (in code that is not shown here).
You may be able to figure out what is happening by setting (in 3.6)
durus.storage_server.TRACE = True
which will print out a trace of all of the data that is
transmitted between the client and the server.
You might want to add the thread ident to the
trace output.
> Form:
>
> Cookies:
> QX_session 510363c7f1146fdb
>
> Environment:
> CONTENT_LENGTH 0
> DOCUMENT_ROOT /usr/pkg/htdocs
> HTTP_ACCEPT */*
> HTTP_ACCEPT_ENCODING gzip
> HTTP_CONNECTION close
> HTTP_COOKIE QX_session="510363c7f1146fdb"
> HTTP_HOST 10.142.7.116
> HTTP_USER_AGENT Limey The Bulldog
> PATH_INFO /browse/16/90
> QUERY_STRING
> REMOTE_ADDR 10.142.7.54
> REMOTE_PORT 61380
> REMOTE_USER Anonymous-68816 None
> REQUEST_METHOD GET
> REQUEST_URI /browse/16/90
> SCGI 1
> SCRIPT_NAME
> SERVER_ADDR 10.142.7.116
> SERVER_ADMIN you@example.com
> SERVER_NAME 10.142.7.116
> SERVER_PORT 80
> SERVER_PROTOCOL HTTP/1.1
> SERVER_SOFTWARE Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.7d
> DAV/2 mod_scgi/1.12
> UNIQUE_ID awWIbwqOB3QAAEXJldcAAAAC
>
>
> [2006-11-13 19:53:46] exception caught
> Traceback (most recent call last):
> File "/home/ah/src/alternate-modules/quixote/publish.py", line
> 278, in process_request
> output = self.try_publish(request)
> File "/home/ah/src/alternate-modules/quixote/publish.py", line
> 253, in try_publish
> output = self.root_directory._q_traverse(components)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 63, in _q_traverse
> return obj._q_traverse(path)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 63, in _q_traverse
> return obj._q_traverse(path)
> File "/home/ah/src/alternate-modules/quixote/directory.py", line
> 57, in _q_traverse
> obj = self._q_lookup(component)
> File "/home/ah/pymods/fidji/ui/browse.ptl", line 122, in _q_lookup
> body(menu(), list_doc())
> File "/home/ah/pymods/fidji/ui/browse.ptl", line 117, in list_doc
> "
%s
"%(i.id,i.nom)
> File "/home/ah/src/alternate-modules/durus/persistent.py", line
> 92, in __getattribute__
> self._p_load_state()
> File "/home/ah/src/alternate-modules/durus/persistent.py", line
> 135, in _p_load_state
> self._p_connection.load_state(self)
> File "/home/ah/src/alternate-modules/durus/connection.py", line
> 185, in load_state
> pickle = self.get_stored_pickle(oid)
> File "/home/ah/src/alternate-modules/durus/connection.py", line
> 111, in get_stored_pickle
> assert oid == oid2
> AssertionError
This is just a continuation of the problem that the client/server
conversation
is out-of-sync.