Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7797 closed defect (duplicate)

"InterfaceError" when restarting postgresql server

Reported by: amalaev@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.11.1
Severity: major Keywords: postgresql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I've setup a trac instance with postgresql as a database backend and now i get "InterfaceError: connection already closed" when stop/start postgresql server.

System info:

  • Linux 2.6.27-7-generic
  • trac 0.11.1 (standalone tracd)
  • Python 2.5.2
  • python-psycopg2 2.0.8-0ubuntu1
  • PostgreSQL 8.3.4

Traceback:

15:40:21 Trac[main] ERROR: connection already closed
Traceback (most recent call last):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 173, in dispatch
    chosen_handler)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 286, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "build/bdist.linux-i686/egg/tracdeveloper/javascript.py", line 14, in pre_process_request
    if req.session.get('developer.js.enable_debug') == '1' and \
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/api.py", line 169, in __getattr__
    value = self.callbacks[name](self)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 257, in _get_session
    return Session(self.env, req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/session.py", line 139, in __init__
    if req.authname == 'anonymous':
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/api.py", line 169, in __getattr__
    value = self.callbacks[name](self)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 131, in authenticate
    authname = authenticator.authenticate(req)
  File "/home/scream/work/trac-0.11.1/source/trac-hacks/svn/accountmanagerplugin/trunk/acct_mgr/web_ui.py", line 429, in wrap
    return func(self, *args, **kwds)
  File "/home/scream/work/trac-0.11.1/source/trac-hacks/svn/accountmanagerplugin/trunk/acct_mgr/web_ui.py", line 440, in authenticate
    return auth.LoginModule.authenticate(self, req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/auth.py", line 70, in authenticate
    authname = self._get_name_for_cookie(req, req.incookie['trac_auth'])
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/auth.py", line 181, in _get_name_for_cookie
    cursor = db.cursor()
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
InterfaceError: connection already closed

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 16 years ago

Does it also happen w/o plugins? If not, trying identifying which plugin introduces the problem.

comment:2 by anonymous, 16 years ago

Yes, it does.

Traceback, w/o plugins:

Traceback (most recent call last):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/api.py", line 339, in send_error
    'text/html')
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/chrome.py", line 684, in render_template
    data = self.populate_data(req, data)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/chrome.py", line 592, in populate_data
    d['chrome'].update(req.chrome)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/api.py", line 169, in __getattr__
    value = self.callbacks[name](self)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/chrome.py", line 460, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/ticket/web_ui.py", line 151, in get_navigation_items
    if 'TICKET_CREATE' in req.perm:
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 523, in has_permission
    return self._has_permission(action, resource)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 537, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 424, in check_permission
    perm)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 282, in check_permission
    get_user_permissions(username)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 357, in get_user_permissions
    for perm in self.store.get_user_permissions(username):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/perm.py", line 174, in get_user_permissions
    cursor = db.cursor()
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
InterfaceError: connection already closed

comment:3 by Christian Boos, 16 years ago

What's in your log file? Do you see other errors happening just before. A quick googling hinted that this error may happen after an OperationalError which actually closes the connection (and so we need to dispose of the Connection wrapper as well).

If you have such an OperationalError in your log, please post the corresponding traceback.

comment:4 by anonymous, 16 years ago

I have OperationalError in log, and InterfaceError after i get OperationalError.

log traceback of two requests after stop/start postgresql:

16:38:56 Trac[main] DEBUG: Dispatching <Request "GET u'/'">
16:38:56 Trac[main] ERROR:  terminating connection due to administrator command
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
Traceback (most recent call last):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/web_ui.py", line 114, in process_request
    page = WikiPage(self.env, pagename)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/model.py", line 43, in __init__
    self._fetch(name, version, db)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/model.py", line 64, in _fetch
    (name,))
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 50, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
OperationalError:  terminating connection due to administrator command
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

16:38:56 Trac[chrome] DEBUG: Prepare chrome data for request
127.0.0.1 - - [07/Nov/2008 16:38:56] "GET /test/ HTTP/1.1" 500 -
Exception psycopg2.InterfaceError: 'connection already closed' in <bound method PooledConnection.__del__ of <trac.db.pool.PooledConnection object at 0x951168c>> ignored
16:38:56 Trac[main] DEBUG: 330 unreachable objects found.
16:41:38 Trac[main] DEBUG: Dispatching <Request "GET u'/'">
16:41:38 Trac[main] ERROR: connection already closed
Traceback (most recent call last):
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/web_ui.py", line 114, in process_request
    page = WikiPage(self.env, pagename)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/model.py", line 43, in __init__
    self._fetch(name, version, db)
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/wiki/model.py", line 54, in _fetch
    cursor = db.cursor()
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
  File "/home/scream/work/trac-0.11.1/source/trac/trac-0.11.1/trac/db/util.py", line 78, in cursor
    return IterableCursor(self.cnx.cursor())
InterfaceError: connection already closed
16:41:38 Trac[chrome] DEBUG: Prepare chrome data for request
127.0.0.1 - - [07/Nov/2008 16:41:38] "GET /test/ HTTP/1.1" 500 -
16:41:39 Trac[main] DEBUG: 107 unreachable objects found.

comment:5 by Christian Boos, 16 years ago

Resolution: duplicate
Status: newclosed

Oh, just realized we already have a ticket for this … see #4984.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.