Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 11 years ago

#9422 closed defect (invalid)

ValueError: year is out of range

Reported by: vasja@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.11.7
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a GET operation on /wiki/WikiProcessors, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'page': u'WikiProcessors'}

System Information

Trac 0.11.7
Python 2.6.5 (r265:79063, Apr 16 2010, 14:15:55)
[GCC 4.4.3]
setuptools 0.6
SQLite 3.6.22
pysqlite 2.4.1
Genshi 0.5.1
mod_wsgi 2.8 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 1.2.2
GIT 1.7.0.4

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 450, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 206, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.6/dist-packages/trac/wiki/web_ui.py", line 118, in process_request
    page = WikiPage(self.env, pagename)
  File "/usr/lib/python2.6/dist-packages/trac/wiki/model.py", line 43, in __init__
    self._fetch(name, version, db)
  File "/usr/lib/python2.6/dist-packages/trac/wiki/model.py", line 70, in _fetch
    self.time = datetime.fromtimestamp(time, utc)
ValueError: year is out of range

Attachments (0)

Change History (5)

comment:1 by Remy Blank, 14 years ago

Resolution: invalid
Status: newclosed

It looks like your database contains invalid data. Did you by any chance try to upgrade to 0.12, and downgrade manually back to 0.11.7? Or do you have both 0.11.7 and 0.12 installed at the same time, and some 0.12 modules have been picked up while running 0.11.7?

You should have a look at the wiki table, and fix the invalid values in the time column manually:

SELECT version, time FROM wiki WHERE name='WikiProcessors'

Anyway, not a bug in Trac itself.

comment:2 by anonymous, 14 years ago

Hi, thank you fro clarification.

Yes I have a little messed up installation.

How can I revert to "clean database"?

Above proposed SQL results in:

1|1276012159000000
2|1276375585964266
3|1276415921

What is easiest way to cleanup full installation?

Thank you!

Vasja

Last edited 14 years ago by Remy Blank (previous) (diff)

comment:3 by Remy Blank, 14 years ago

The easiest would be to restore a pre-upgrade backup.

If you can't do that, you could try to revert the timestamps to seconds. For the wiki table, that would be:

UPDATE wiki SET time = time / 1000000 WHERE time > 20000000000;

Repeat for all columns containing timestamps, in all tables.

The timestamps could only be part of the issue, though. Other data may have been stored incorrectly due to the version mix. So the restore would definitely be the best option. Whatever you do, make sure you make a backup before trying anything.

Please ask on the MailingList or IrcChannel if you need more help.

comment:4 by anonymous, 12 years ago

Had to actually do this when changing to older Debian installation. For anyaone intrested I did these updates:

UPDATE attachment SET time = time / 1000000 WHERE time > 20000000000;
UPDATE wiki SET time = time / 1000000 WHERE time > 20000000000;
UPDATE ticket SET time = time / 1000000 WHERE time > 20000000000;
UPDATE ticket SET changetime = changetime / 1000000 WHERE changetime > 20000000000;
UPDATE ticket_change SET time = time / 1000000 WHERE time > 20000000000;
UPDATE milestone SET due = due / 1000000 WHERE due > 20000000000;
UPDATE milestone SET completed = completed / 1000000 WHERE completed > 20000000000;
UPDATE version SET time = time / 1000000 WHERE time > 20000000000;

comment:5 by anonymous, 11 years ago

wat trying upgrade from 0.11 to 1 got same error these SQL'a helped

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.