Edgewall Software

Opened 14 years ago

Last modified 14 years ago

#8969 closed defect

IntegrityError: columns cookie, ipnr, name are not unique — at Initial Version

Reported by: sistemas@… Owned by:
Priority: normal Milestone: 0.12.2
Component: general Version: 0.11.1
Severity: normal Keywords: session, pysqlite
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

First of all, I have read tickets #2570, #7096 and #8052. The solution proposed is to upgrade to 0.11, which we are already using.

I have confirmed trac/util/init.py uses sha instead of md5.

We have been using 0.11.1 for a few months already. This error has appeared at a time when we have started to try out SSL client authentication, but won't disappear after we have disabled it, so we aren't sure whether there is a cause-effect relationship.

Cleaning up the browser cookies or restarting the apache server won't help.

Trac detected an internal error:

IntegrityError: columns cookie, ipnr, name are not unique

Cookie ID has been deliberately obscured in the following traceback:

Python Traceback
Most recent call last:

    * File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 423, in _dispatch_request
      Code fragment:
       418. try:
       419. if not env and env_error:
       420. raise HTTPInternalError(env_error)
       421. try:
       422. dispatcher = RequestDispatcher(env)
       423. dispatcher.dispatch(req)
       424. except RequestDone:
       425. pass
       426. resp = req._response or []
       427.  
       428. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[u' except RequestDone:', u' pass', u' resp = ...
      before 	[u' try:', u' if not env and env_error:', u' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x2ad92d151050>
      e 	<_sqlite.IntegrityError instance at 0x2ad92f4a80e0>
      env 	<trac.env.Environment object at 0x2ad92b8a1810>
      env_error 	None
      exc_info 	(<class _sqlite.IntegrityError at 0x2ad92ca71d10>, <_sqlite.IntegrityError ...
      filename 	'/usr/lib/python2.4/site-packages/trac/web/main.py'
      frames 	[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
      has_admin 	True
      line 	u' dispatcher.dispatch(req)'
      lineno 	422
      message 	u'IntegrityError: columns cookie, ipnr, name are not unique'
      req 	<Request "GET u'/login'">
      resp 	[]
      tb 	<traceback object at 0x2ad92f4a81b8>
      tb_hide 	None
      traceback 	'Traceback (most recent call last):\n File ...
    * File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 197, in dispatch
      Code fragment:
       192. req.args.get('__FORM_TOKEN') != req.form_token:
       193. raise HTTPBadRequest('Missing or invalid form token. '
       194. 'Do you have cookies enabled?')
       195.  
       196. # Process the request and render the template
       197. resp = chosen_handler.process_request(req)
       198. if resp:
       199. if len(resp) == 2: # Clearsilver
       200. chrome.populate_hdf(req)
       201. template, content_type = \
       202. self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<trac.web.auth.LoginModule object at 0x2ad92d151590>
      chrome 	<trac.web.chrome.Chrome object at 0x2ad92bf777d0>
      err 	(<class _sqlite.IntegrityError at 0x2ad92ca71d10>, <_sqlite.IntegrityError ...
      handler 	<trac.web.auth.LoginModule object at 0x2ad92d151590>
      req 	<Request "GET u'/login'">
      self 	<trac.web.main.RequestDispatcher object at 0x2ad92d151050>
    * File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 101, in process_request
      Code fragment:
        96. def match_request(self, req):
        97. return re.match('/(login|logout)/?$', req.path_info)
        98.  
        99. def process_request(self, req):
       100. if req.path_info.startswith('/login'):
       101. self._do_login(req)
       102. elif req.path_info.startswith('/logout'):
       103. self._do_logout(req)
       104. self._redirect_back(req)
       105.  
       106. # Internal methods
      Local variables:
      Name	Value
      req 	<Request "GET u'/login'">
      self 	<trac.web.auth.LoginModule object at 0x2ad92d151590>
    * File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 140, in _do_login
      Code fragment:
       135.  
       136. cookie = hex_entropy()
       137. db = self.env.get_db_cnx()
       138. cursor = db.cursor()
       139. cursor.execute("INSERT INTO auth_cookie (cookie,name,ipnr,time) "
       140. "VALUES (%s, %s, %s, %s)", (cookie, remote_user,
       141. req.remote_addr, int(time.time())))
       142. db.commit()
       143.  
       144. req.authname = remote_user
       145. req.outcookie['trac_auth'] = cookie
      Local variables:
      Name	Value
      cookie 	'af8b74xxxxxxxxxxxxxxxx4039'
      cursor 	<trac.db.util.IterableCursor object at 0x2ad92f4a5408>
      db 	<trac.db.pool.PooledConnection object at 0x2ad92f4a2ea8>
      remote_user 	'myuser'
      req 	<Request "GET u'/login'">
      self 	<trac.web.auth.LoginModule object at 0x2ad92d151590>
    * File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
      Code fragment:
        45. def execute(self, sql, args=None):
        46. # -- In case of SQL errors, uncomment the following 'print' statements
        47. # print 'execute', repr(sql)
        48. if args:
        49. # print repr(args)
        50. return self.cursor.execute(sql_escape_percent(sql), args)
        51. return self.cursor.execute(sql)
        52.  
        53. def executemany(self, sql, args=None):
        54. # print 'executemany', repr(sql)
        55. if args:
      Local variables:
      Name	Value
      args 	('af8b74xxxxxxxxxxxxxxxx4039', 'myuser', '10.0.0.105', 1263479383)
      self 	<trac.db.util.IterableCursor object at 0x2ad92f4a5408>
      sql 	'INSERT INTO auth_cookie (cookie,name,ipnr,time) VALUES (%s, %s, %s, %s)'
    * File "/usr/lib64/python2.4/site-packages/sqlite/main.py", line 255, in execute
      Code fragment:
       250. parms = _quoteall(parms[0])
       251. else:
       252. parms = self._unicodeConvert(parms)
       253. parms = tuple(map(_quote, parms))
       254.  
       255. self.rs = self.con.db.execute(SQL % parms)
       256.  
       257. self.closed = 0
       258. self.current_recnum = 0
       259.  
       260. self.rowcount, self._real_rowcount = [len(self.rs.row_list)] * 2
      Local variables:
      Name	Value
      SQL 	'INSERT INTO auth_cookie (cookie,name,ipnr,time) VALUES (%s, %s, %s, %s)'
      parms 	("'af8b74047249852d148c3da0590b4039'", "'myuser'", "'10.0.0.105'", ...
      self 	<trac.db.sqlite_backend.SQLiteUnicodeCursor instance at 0x2ad92f4a2fc8>

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 423, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 197, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 101, in process_request
  self._do_login(req)
File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 140, in _do_login
  "VALUES (%s, %s, %s, %s)", (cookie, remote_user,
File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib64/python2.4/site-packages/sqlite/main.py", line 255, in execute
  self.rs = self.con.db.execute(SQL % parms)

System Information:

User Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.6) Gecko/20091216 Fedora/3.5.6-1.fc11 Firefox/3.5.6
Trac: 	0.11.1
Python: 	2.4.3 (#1, May 24 2008, 13:57:05) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]
setuptools: 	0.6c5
SQLite: 	3.3.6
pysqlite: 	1.1.7
Genshi: 	0.5.1
mod_python: 	3.2.8
Subversion: 	1.4.2 (r22196)
jQuery:	1.2.6

Change History (0)

Note: See TracTickets for help on using tickets.