Public bug reported:

[ Impact ]

 * reprepro keeps all repository state in Berkeley DB files under db/
   (checksums.db, packages.db, references.db, packagenames.db). It opens them
   without a transactional environment, so they are only consistent if
   reprepro closes them cleanly before it exits.

 * reprepro handles SIGTERM, SIGINT, SIGQUIT and SIGABRT by stopping through
   its graceful interruption path, which closes the databases and removes
   db/lockfile. It does not handle SIGHUP. When the terminal reprepro runs on
   goes away, the kernel sends it SIGHUP and it dies at once with its
   databases open. That happens when an ssh session drops, when the process
   that started reprepro on a pty exits, or a reboot.

 * If the hangup arrives while reprepro is writing (from "Installing (and
   possibly deleting) packages..." until it closes its databases), the
   databases are left corrupt and db/lockfile is left behind.

 * Landscape Server mirrors Ubuntu archives with reprepro. Its
   job-handler service runs "reprepro update" on a pty (Twisted
   spawnProcess with usePTY=True) so it can read the line-buffered
   "--show-percent" progress output. Stopping job-handler (e.g. a Landscape
   restart or a reboot) closes the pty, and reprepro
   receives SIGHUP. If a mirror sync is in its install phase at that moment,
   the databases of that distribution are corrupted. Every series and pocket
   of a distribution shares one db/, so the damage is not limited to the
   pocket that was syncing. Landscape takes sync progress only from
   reprepro's "Got N%" lines, so a later sync where reprepro loops on the
   damaged btree shows 0% indefinitely, with no error.

[ Test Plan ]

todo

[ Where problems could occur ]

 * The change is in signal setup at the start of main(). If it were wrong,
   the visible effect would be in how reprepro reacts to a terminal hangup.
   Repository contents, the database format and the command line are not
   touched.

todo

[ Other Info ]

todo

** Affects: reprepro (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169601

Title:
  SIGHUP during db write corrupts the repository

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/reprepro/+bug/2169601/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to