00543: Commiting a change when disk is full loses data

Summary: Commiting a change when disk is full loses data
Created: 2005-09-27 15:47
Status: Closed - no response
Category: Bug
Priority: 5
Version: 2.0-beta38
OS: Linux-2.6 Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5 PHP/4.4.0-2 Server

Description: When the disk was full, a user tried to update a page, and as a result the page was truncated to a size of 0 and <Group>.RecentChanges and <Group>.AllRecentChanges were also truncated to a size of 0.

Reproducibility: Unknown

Steps to reproduce: 1) Fill up hd 2) Try editing a page and submitting changes

We luckily had a backup of the server data, but it might be a good idea (for in the future) to allow some kind of revision system to handle page changes, at least as an option for people who want extra assurance that nothing will be lost.

Contact: jeremy_AT_1stplayable_DOT_com

There almost has to be something else going on here -- PmWiki already does lots of checks to make sure that pages aren't truncated by disk full errors:

  1. When saving a page, the new data is saved to a page file with a ",new" extension. The existing page file is not replaced until the ,new file has been written successfully.
  2. Every open, write, and close operation is checked for an error; if any errors occur while writing the ,new file, then the existing file is left alone.
  3. Since beta37, after the ,new page file has been written and closed, PmWiki checks that its filesize is at least 95% of the expected size; if not, then the original page file is not replaced.

While I can imagine that the ,new file was created with zero bytes (there are some PHP and OS installations that do not correctly report write errors), I don't see how it's possible for the file to have gotten past the filesize check from #3 above. So, there must be something else happening here.

  • Are you certain that you're running beta38?
  • Can you send me a copy of your pmwiki.php and/or index.php file so I can look at them?