Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8324 closed defect (invalid)

SQLite corruption "Session already exists: database disk image is malformed"

Reported by: Giacomo Tenaglia <Giacomo.Tenaglia@…> Owned by:
Priority: normal Milestone:
Component: wiki system Version: 0.11.3
Severity: major Keywords: sqlite
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Hi, over the weekend I migrated a very big CVS repository to SVN (about 190K revisions), and I've setup trac as a web browser.

Today I've experienced a "database malformed" error while logging in. In the trac.log I have the following:

2009-05-26 09:57:23,736 Trac[session] WARNING: Session ddc0ac8a7aa2a8f4d778fc0f already exists: database disk image is malformed
2009-05-26 10:50:31,608 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 435, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 104, in process_request
    self._redirect_back(req)
  File "/usr/lib/python2.4/site-packages/trac/web/auth.py", line 209, in _redirect_back
    req.redirect(referer or req.abs_href())
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 293, in redirect
    if self.session:
  File "/usr/lib/python2.4/site-packages/trac/web/api.py", line 194, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 267, in _get_session
    return Session(self.env, req)
  File "/usr/lib/python2.4/site-packages/trac/web/session.py", line 156, in __init__
    self.promote_session(sid)
  File "/usr/lib/python2.4/site-packages/trac/web/session.py", line 241, in promote_session
    (self.req.authname, int(time.time())))
  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/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 58, in execute
    args or [])
  File "/usr/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 50, in _rollback_on_error
    return function(self, *args, **kwargs)
DatabaseError: database disk image is malformed

If I cleaned the trac cookies the issue didn't show up, but as soon as I clicked on "login" it showed the same behaviour.

After asking on #trac freenode channel, I've delete all the content of the tables session and session_attribute, and this solved the problem.

Here's the content of the tables _before_ the cleaning (I've obfuscated some usernames and email addresses):

sqlite> select * from session;                                         
08c8602a437a81d138adfb5b|0|1243156728                                  
abb16ab10a47866f4799f18f|0|1243160104                                  
168459e9425e091f17a9cfba|0|1243160663                                  
b9d07ebeea330b423398ebfb|0|1243160922                                  
3bb19b9a7866912036bbcdf2|0|1243161389                                  
64d4a86b342b6944b326bf84|0|1243169127                                  
f6b5eb3e2120af4eca0ffc45|0|1243169832                                  
96d18a8ab688197c53b26902|0|1243171385                                  
e0c415dc63d57f92add8dc31|0|1243173645                                  
c30e6111728683e5a1dcf73e|0|1243174265                                  
00e6ef52150c982349d77cd7|0|1243175940                                  
a2136497b72b310cc158fbbb|0|1243176321                                  
7c6f2b933c0ba14e2ff71811|0|1243176924                                  
4957f7d238276d67f23d733a|0|1243177373                                  
9eb58fcc9ddfb5a0e728b9f9|0|1243177649                                  
57a23289ca98d135778867dc|0|1243177859                                  
2907a6997f2285e9d1f5752b|0|1243178171                                  
78631527b5e3ca90a772eb5a|0|1243180169                                  
a296fcee2670115c07c9092e|0|1243189871                                  
7a1570e53cc62ab7327627f4|0|1243190392                                  
152a7d8174f04e3da49aa78a|0|1243191470                                  
username1|1|1243211048                                                  
a89ba2e5be71a1a8683c3f4e|0|1243214807                                  
87a46ac093e46472335f398d|0|1243229154                                  
7d0e36aaae864706e024e07a|0|1243229393                                  
cb64b8edf312c394865fef09|0|1243229766                                  
ec88bf132e259dc0c3c73260|0|1243230448                                  
4ace22f09d8df46559c83814|0|1243230865                                  
fb2614bd7581d2664c8660fa|0|1243232300                                  
aa4d0664882d91de96da6863|0|1243233558                                  
41246c2cc7cb44384536337c|0|1243234386                                  
3f6047981d16e80f4fe8e099|0|1243234946                                  
d2d436b6a8597ea65d4ed204|0|1243238599                                  
username2|1|1243239475                                                  
672fd7105a576028cebfd0db|0|1243240121                                  
c23d902b0ed130fb46aff242|0|1243241519                                  
4351b6fafff7144b471d5a6b|0|1243241713                                  
c6c0903aa95130610b59aabe|0|1243242345                                  
9181af2f620a80a59a0b2417|0|1243242677
13f4f659dd3616f5c3a76eb2|0|1243244416                                  
e589c9f22a72ce2a606fc3e9|0|1243244659                                  
84c710ef3a990b017fd343e3|0|1243245566                                  
username3|1|1243248424                                                  
7f35e967f9b853aca3983edc|0|1243250841                                  
959fccb965ea0cf9abc24fbc|0|1243252904                                  
a29570481aa15b50493b5aad|0|1243252988                                  
80dfa4736be97aa479d8c007|0|1243254320                                  
d9173aef8fbce815896a0cc7|0|1243254363                                  
1340d3de096bcb17de4c79a6|0|1243256096                                  
b17f6d0f97ad391acf567e94|0|1243264574                                  
01e1dce8ef7e5e29b4497a19|0|1243264725                                  
fb5c5469a9f3fe3a520acd3d|0|1243265437                                  
e21754af530ae39fdd323714|0|1243265446                                  
464a661be36d233f73496220|0|1243265769                                  
f088f9884ba9609f482b0ff7|0|1243266237                                  
5c16d96b2ca505fa415fdd12|0|1243267088                                  
||                                                                     
||                                                                     
||                                                                     
||                                                                     
||                                                                     
||                                                                     
||                                                                     
||                                                                     
||                                                                     
sqlite> select * from session_attribute;
08c8602a437a81d138adfb5b|0|timeline.daysback|30
abb16ab10a47866f4799f18f|0|timeline.daysback|30
168459e9425e091f17a9cfba|0|timeline.daysback|30
b9d07ebeea330b423398ebfb|0|timeline.daysback|30
3bb19b9a7866912036bbcdf2|0|timeline.daysback|30
64d4a86b342b6944b326bf84|0|timeline.daysback|30
f6b5eb3e2120af4eca0ffc45|0|timeline.daysback|30
96d18a8ab688197c53b26902|0|timeline.daysback|30
e0c415dc63d57f92add8dc31|0|timeline.daysback|30
c30e6111728683e5a1dcf73e|0|timeline.daysback|30
00e6ef52150c982349d77cd7|0|timeline.daysback|30
a2136497b72b310cc158fbbb|0|timeline.daysback|30
7c6f2b933c0ba14e2ff71811|0|timeline.daysback|30
4957f7d238276d67f23d733a|0|timeline.daysback|30
9eb58fcc9ddfb5a0e728b9f9|0|timeline.daysback|30
57a23289ca98d135778867dc|0|timeline.daysback|30
2907a6997f2285e9d1f5752b|0|timeline.daysback|30
78631527b5e3ca90a772eb5a|0|timeline.daysback|30
a296fcee2670115c07c9092e|0|diff_style|sidebyside
7a1570e53cc62ab7327627f4|0|timeline.daysback|30 
152a7d8174f04e3da49aa78a|0|timeline.daysback|30 
a89ba2e5be71a1a8683c3f4e|0|timeline.daysback|30 
87a46ac093e46472335f398d|0|timeline.daysback|30 
7d0e36aaae864706e024e07a|0|timeline.daysback|30 
cb64b8edf312c394865fef09|0|timeline.daysback|30 
ec88bf132e259dc0c3c73260|0|timeline.daysback|30 
4ace22f09d8df46559c83814|0|timeline.daysback|30 
fb2614bd7581d2664c8660fa|0|timeline.daysback|30
aa4d0664882d91de96da6863|0|timeline.daysback|30 
41246c2cc7cb44384536337c|0|timeline.daysback|30 
3f6047981d16e80f4fe8e099|0|timeline.daysback|30 
d2d436b6a8597ea65d4ed204|0|timeline.daysback|30 
username1|1|timeline.daysback|30                 
672fd7105a576028cebfd0db|0|timeline.daysback|30 
c23d902b0ed130fb46aff242|0|timeline.daysback|30 
4351b6fafff7144b471d5a6b|0|timeline.daysback|30 
c6c0903aa95130610b59aabe|0|query_href|/trac/atlasoff/report/7?USER=anonymous&page=1
c6c0903aa95130610b59aabe|0|query_tickets|                                          
9181af2f620a80a59a0b2417|0|timeline.daysback|30                                    
9181af2f620a80a59a0b2417|0|email|XXXXXX@XXXXXX.XX                             
9181af2f620a80a59a0b2417|0|name|Sebastian XXXXXX                                
13f4f659dd3616f5c3a76eb2|0|timeline.daysback|30                                    
e589c9f22a72ce2a606fc3e9|0|timeline.daysback|30                                    
84c710ef3a990b017fd343e3|0|timeline.daysback|30                                    
959fccb965ea0cf9abc24fbc|0|timeline.daysback|30                                    
a29570481aa15b50493b5aad|0|diff_style|sidebyside                                   
80dfa4736be97aa479d8c007|0|timeline.daysback|30                                    
d9173aef8fbce815896a0cc7|0|query_href|/trac/atlasoff/report/1?USER=anonymous&page=1
d9173aef8fbce815896a0cc7|0|query_tickets|                                          
1340d3de096bcb17de4c79a6|0|timeline.daysback|30                                    
01e1dce8ef7e5e29b4497a19|0|timeline.daysback|30                                    
fb5c5469a9f3fe3a520acd3d|0|timeline.daysback|30                                    
e21754af530ae39fdd323714|0|timeline.daysback|30                                    
464a661be36d233f73496220|0|timeline.daysback|30                                    
f088f9884ba9609f482b0ff7|0|timeline.daysback|30                                    
5c16d96b2ca505fa415fdd12|0|timeline.daysback|30
5aa93ade3667e1dfe4dc1a82|0|timeline.daysback|30                                    
b17f6d0f97ad391acf567e94|0|timeline.daysback|30                                    
7f35e967f9b853aca3983edc|0|timeline.daysback|30                                    
7f35e967f9b853aca3983edc|0|diff_ignorewhitespace|1                                 
7f35e967f9b853aca3983edc|0|diff_contextlines|500                                   
7f35e967f9b853aca3983edc|0|diff_ignoreblanklines|1                                 
7f35e967f9b853aca3983edc|0|diff_style|sidebyside                                   
be6e39240f37af5458584362|0|timeline.daysback|30                                    
1ca05353c0cfa8acb2a923ea|0|timeline.daysback|30                                    
a0297ecaaaca8b20fe6d66fd|0|timeline.daysback|30                                    
15b5f0f8e739f3df31ad5f0c|0|timeline.daysback|30                                    
9c28f6c64ef277ff80bae984|0|timeline.daysback|30                                    
f03de09cd6290a3babcd3d22|0|timeline.daysback|30                                    
3ca62cffc408a2f147e7ac76|0|timeline.daysback|30                                    
dc9dba5608213afe91a42ab6|0|timeline.daysback|30                                    
fb10f89cab4bc3234b0efba4|0|timeline.daysback|30                                    
4a4f1038a08b6b6f877a9561|0|timeline.daysback|30                                    
6107f63bd35aaa72a9a047fa|0|timeline.daysback|30                                    
8c3df23c75906ca358c906b8|0|timeline.daysback|30                                    
bad9a2684a9b0a3ba9a01a71|0|timeline.daysback|30                                    
d9a3a3e8d4049d0731540c51|0|timeline.daysback|30                                    
4f409d3032f343d6558e2e89|0|timeline.daysback|30                                    
7191423d86af9f132ac713fc|0|timeline.daysback|30                                    
6ca52ba60b32e5d8efd6b1e5|0|timeline.daysback|30                                    
29039782fa0066436bbd4f62|0|timeline.daysback|30                                    
ec93261ab401702ff15f98e3|0|timeline.daysback|30                                    
4425e170338ca7839e092cdd|0|timeline.daysback|30                                    
df01a6412a5c3825b737c1aa|0|timeline.daysback|30
5348e464093dfe46b8f9963c|0|timeline.daysback|30                                    
c7b4aa96c97e4ca758db7cf2|0|timeline.daysback|30                                    
b75f26d1ccb93f058e791ccd|0|timeline.daysback|30                                    
486246945dab7f07cace6d52|0|timeline.daysback|30                                    
1ada24cd1f025f72118cf5e1|0|timeline.daysback|30                                    
03927f0928b84368d19f86e7|0|timeline.daysback|30                                    
492dcf971dab33bb24ac7806|0|timeline.daysback|30                                    
d4db995e13897c33cf47ba46|0|timeline.daysback|30                                    
feb0ec77a437524a22e6a12d|0|timeline.daysback|30                                    
7b1574b36f90fbc7ad2573a2|0|timeline.daysback|30                                    
45d3dd2b02974a15595d2daf|0|timeline.daysback|30                                    
9d38ca71fd12f689ec30f0a4|0|timeline.daysback|30                                    
5d8794721d9b5fe168c635f7|0|timeline.daysback|30                                    
8850ccaed4b6365a79052442|0|timeline.daysback|30                                    
8e73c8f5cf1bc62a9de25853|0|timeline.daysback|30                                    
cb35e5c1c0654c924e60173a|0|timeline.daysback|30                                    
f39b0ef2f944fabcb29aa752|0|diff_style|sidebyside                                   
e5bf427ff315b2cc5ba643f4|0|name|James XXXXXX                                      
e5bf427ff315b2cc5ba643f4|0|email|james.XXXXXX@XXXX.XX                             
eace9d462ad00898fc596382|0|timeline.daysback|30                                    
440cb3afac0b3a4f81bb9be8|0|timeline.daysback|30                                    
ddc0ac8a7aa2a8f4d778fc0f|0|timeline.daysback|30                                    
e46fd6845d908e0c937e8621|0|timeline.daysback|30                                    
0de5270169b2f3cd0bc8b483|0|timeline.daysback|30                                    
e8bedff63e0cfe373cba5046|0|timeline.daysback|30                                    
sqlite>

How to reproduce: I don't know.

System informations:

  • Operating system: Linux myhost 2.6.18-92.1.18.el5 #1 SMP Wed Nov 12 06:45:11 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
  • Python: python-2.4.3-24.el5
  • Database backend: sqlite-3.3.6-2, python-sqlite2-2.3.3-3_0.1.el5

Do you know what can be causing this, and how I can avoid it showing up in the future ?

Thanks, Giacomo

Attachments (0)

Change History (5)

comment:1 by Giacomo Tenaglia <Giacomo.Tenaglia@…>, 15 years ago

If needed you can contact me on #trac freenode channel, I'm "tenaglia".

in reply to:  description comment:2 by Christian Boos, 15 years ago

Keywords: sqlite added

Replying to Giacomo Tenaglia <Giacomo.Tenaglia@…>:

  • Database backend: sqlite-3.3.6-2, python-sqlite2-2.3.3-3_0.1.el5

Do you know what can be causing this, and how I can avoid it showing up in the future ?

No, but the fact that you're getting an error saying "database disk image is malformed" is indicative of a problem at SQLite's level, not Trac.

Both SQLite 3.3.6 and pysqlite 2.3.3 are quite old now, you should upgrade to something more recent. By building it yourself, you'll be sure that it is configured with --enable-threadsafe, which was not set by default on Linux a while ago. If this was the case for your sqlite-3.3.6-2 package, that may explain the error.

You should also check the database and dump/restore your SQLite db/trac.db file, as explained in PySqlite#OperationalError:SQLlogicerrorormissingdatabase.

comment:3 by Giacomo Tenaglia <Giacomo.Tenaglia@…>, 15 years ago

Resolution: invalid
Status: newclosed

Hi, JFTR the problem was linked to the fact that SQLite was on AFS, which has poor file locking techniques. When moved to NFSv4 the problem went away.

Concerning your suggestion to upgrade, at the moment we cannot do that, but since it's been running for about one month without issues I guess it was an invalid bug.

Cheers, giacomo

comment:4 by Christian Boos, 15 years ago

Thanks for the update. Indeed SQLite doesn't seem to support AFS yet (cvstrac:ticket:2136).

comment:5 by Christian Boos, 15 years ago

Hm, rather: sqlitetkt:2136

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.