gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] GNUmed web interface - pyjamas


From: Sebastian Hilbert
Subject: Re: [Gnumed-devel] GNUmed web interface - pyjamas
Date: Mon, 12 Jul 2010 13:11:07 +0200
User-agent: KMail/1.13.3 (Linux/2.6.33-6-desktop; KDE/4.4.5; i686; ; )

Am Montag 12 Juli 2010, 09:36:43 schrieb Karsten Hilbert:
> On Sun, Jul 11, 2010 at 01:59:52PM -0700, lkcl wrote:
> >  so, one on the TODO list for you already: solve the psycopg2 problem, or
> 
> In case you are using the GNUmed middleware - we only
> initiate two or so connections per thread.
> 

I have incorporated lkcl's patch and published my work at

http://gitorious.org/gnumed-
shilbert/gnumed/trees/webui/gnumed/gnumed/client/CherryPy

I can log in via localhost:8080 just fine.
When I try to run testjsonrpc.py while the webbrowser session is active I get

-----------------------------------------------------------------------------------------------------

[12/Jul/2010:12:04:52] HTTP Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cherrypy/_cprequest.py", line 606, in 
respond
    cherrypy.response.body = self.handler()
  File "/usr/lib/python2.6/site-packages/cherrypy/_cpdispatch.py", line 25, in 
__call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/CherryPy/gmGuiWeb.py", line 376, in services
    res = f(*kwargs['params'])
  File "/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/CherryPy/gmGuiWeb.py", line 388, in 
get_schema_version
    return gmPG2.get_schema_version()
  File "/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/pycommon/gmPG2.py", line 458, in 
get_schema_version
    rows, idx = run_ro_queries(link_obj=link_obj, queries = [{'cmd': u'select 
md5(gm.concat_table_structure()) as md5'}])
  File "/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/pycommon/gmPG2.py", line 970, in run_ro_queries
    conn = get_connection(readonly=True, verbose=verbose)
  File "/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/pycommon/gmPG2.py", line 1271, in get_connection
    conn = __ro_conn_pool.getconn()
  File "/usr/lib/python2.6/site-packages/psycopg2/pool.py", line 215, in 
getconn
    return self._getconn(key)
  File "/usr/lib/python2.6/site-packages/psycopg2/pool.py", line 107, in 
_getconn
    raise PoolError("connection pool exausted")
PoolError: connection pool exausted



When no other "session" is running all is fine as per below 
---------------------------------------------------------------------------

./gm-from-vcs.sh --ui=
-------------------------------------------------
Running from Git branch: * webui
-------------------------------------------------
GNUmed startup: Running from local source tree.
-----------------------------------------------
Adjusting PYTHONPATH ...
/home/basti/Sources/gnumed-
shilbert/gnumed/gnumed/Gnumed/pycommon/gmTools.py:11: DeprecationWarning: the 
MimeWriter module is deprecated; use the email package instead
  import urllib2 as wget, decimal, StringIO, MimeWriter, mimetypes, mimetools
[12/Jul/2010:12:30:57] ENGINE Listening for SIGHUP.
[12/Jul/2010:12:30:57] ENGINE Listening for SIGTERM.
[12/Jul/2010:12:30:57] ENGINE Listening for SIGUSR1.
[12/Jul/2010:12:30:57] ENGINE Bus STARTING
[12/Jul/2010:12:30:57] ENGINE Started monitor thread '_TimeoutMonitor'.
[12/Jul/2010:12:30:57] ENGINE Started monitor thread 'Autoreloader'.
[12/Jul/2010:12:30:58] ENGINE Serving on 127.0.0.1:8080
[12/Jul/2010:12:30:58] ENGINE Bus STARTED
before_handler jsonrpc
json_string [{"params": ["any-doc", "any-doc"], "method": "login", "id": 2}]
echo service
()
{'params': [u'any-doc', u'any-doc'], 'method': u'login', 'id': 2}
127.0.0.1 - - [12/Jul/2010:12:32:21] "POST /services HTTP/1.0" 200 40 "" 
"jsonlib.py/0.0.1 (by matt harrison)"
before_handler jsonrpc
json_string [{"params": [], "method": "get_schema_version", "id": 3}]
echo service
()
{'params': [], 'method': u'get_schema_version', 'id': 3}
127.0.0.1 - - [12/Jul/2010:12:32:21] "POST /services HTTP/1.0" 200 117 "" 
"jsonlib.py/0.0.1 (by matt harrison)"
before_handler jsonrpc
json_string [{"params": [], "method": "get_doc_types", "id": 4}]
echo service
()
{'params': [], 'method': u'get_doc_types', 'id': 4}
127.0.0.1 - - [12/Jul/2010:12:32:21] "POST /services HTTP/1.0" 200 836 "" 
"jsonlib.py/0.0.1 (by matt harrison)"

-------------------------------------------------------------------------------------
When I run  testjsonrpc.py again the connection pool exhausted error turns up 
as well.

As far as I can see for the two  testjsonrpc.py calls the error turns up 
because cherrypy has a connection established already from the first call.

The way out would be to hook into GNUmed's connection pool instead of calling 
the login function all the time.

What confuses me is the fact that you can log into the db with multiple 
wxpython clients at the same time. So it should be possible with multiple 
testjsonrpc.py instances as well. 

Wait the problem is not testjsonrpc.py but cherrypy being called (which 
already has an active connection) ? that would mean the cherrypy server stuff 
I wrote needs to be enhanced in the way that it allows multiple connections.

I am off to wrap my head arount it.

Sebastian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]