Opened 18 years ago
Closed 16 years ago
#5222 closed defect (worksforme)
trac-admin hotcopy database corruption
Reported by: | 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 , 18 years ago
comment:2 by , 18 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 , 18 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 , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:7 by , 16 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 , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
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.
Which version of Trac are you using?
I wonder whether it could be related to the charset settings.
Could you try to define
in your backup script, before the trac-admin command ?