Edgewall Software
Modify

Opened 17 years ago

Closed 15 years ago

#5222 closed defect (worksforme)

trac-admin hotcopy database corruption

Reported by: paul_homer@… Owned by: Christopher Lenz
Priority: high Milestone:
Component: admin/console Version:
Severity: critical Keywords: needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When using trac-admin hotcopy in a script run by backup software, after the copy the original Sqlite database trac gets a "database disk image is malformed" error. This problem doesn't happen when running interactively or when running from an interactive shell. It is likely caused from being run as a daemon (and not being attached to a terminal?).

The workaround seems to be to run the command in a bourne shell with all output piped to a file, as in: "trac-admin /trac/repository hotcopy /dst > /tmp/file 2>&1".

Attachments (0)

Change History (8)

comment:1 by Emmanuel Blot, 17 years ago

Which version of Trac are you using?

I wonder whether it could be related to the charset settings.
Could you try to define

export LC_CTYPE=UTF-8

in your backup script, before the trac-admin command ?

comment:2 by anonymous, 17 years ago

The Trac Version is 0.10.3.1. The OS is a vanilla Fedora, generally kept up-to-date with livna. From trac.conf for Apache, TracLocale is set to "en_CA.UTF-8". Running under the backup in the shell, there are several LC variables all set to en_US (LANG is set to en_US.UTF-8.

I've added another test script with your shell variable, it will run tonight. I don't want to mess up the existing backups and I'm not sure how to reproduce the error outside of the backup scripts (cron perhaps?). I'll post another comment tommorrow with the results.

My sense is that trac-admin is trying to write its status message "into" the database, is that true?

comment:3 by paul_homer@…, 17 years ago

I added the export just before the call to trac-admin (and removed the redirects). It continued to fail, but the message in the database file was missing the 'done' part of the string. It turns out that the directory that I was copying to in the hotcopy doesn't exist, so the hotcopy failed with some error. What is really interesting is that the stdout message gets written to the database, while the stderr message goes somewhere else. I havn't found the err message yet, so it may have been sent to /dev/null or the stream may have been closed. Not sure. Doesn't seem like a Locale problem.

comment:4 by anonymous, 17 years ago

Resolution: fixed
Status: newclosed

comment:5 by Emmanuel Blot, 17 years ago

Resolution: fixed
Status: closedreopened

who's anonymous?

comment:6 by Remy Blank, 16 years ago

Keywords: needinfo added

Does this still happen with current 0.11.1?

comment:7 by tudalex@…, 15 years ago

It works for me in 0.11.1 using a php script run by cron to back it up. What backup software was he using?

comment:8 by Christian Boos, 15 years ago

Resolution: worksforme
Status: reopenedclosed

Weird:

What is really interesting is that the stdout message gets written to the database, while the stderr message goes somewhere else. I havn't found the err message yet

I don't see how this could possibly happen (stdout of trac-admin written in the SQLite database?). In the absence of more precise informations (e.g. a script which could be used to reproduce the problem), there's not much we can do.

As mentioned in the comment:7 above, trac-admin hotcopy should work when called from another program, it doesn't need to be run from an interactive shell.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz 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.