partial file writes on power loss

Bug #1691193 reported by Gabriel Samfira
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Gabriel Samfira

Bug Description

While deploying a new unit, in the event of a power loss or forced reset, the uniter state file, and various charm files (actions.yaml, revision, etc) might get corrupted. This is 100% reproducible on Windows systems where file buffers and disk cache is enabled by default.

To get around this we have 2 options:

1) use directIO on all supported platforms. This approach should always be used when writing config files or state files. Well, I would extend this to any charm files to be hones. However, it involves aligning blocks in memory before sending them to Write()

2) Call Sync() on a file handle before explicitly calling Close(). I would also recommend we explicitly call Close() before returning in any function that opens a file for writing. Defering a file close might lead to leaked file handles. On Windows systems (unline Linux) it also prevents any other application/function from manipulating a file that still has an open handle.

A PR for this has been proposed at:

https://github.com/juju/utils/pull/279

Revision history for this message
Anastasia (anastasia-macmood) wrote :

Juju PR against develop (2.2): https://github.com/juju/juju/pull/7358

Changed in juju:
status: New → Fix Committed
milestone: none → 2.2-rc1
John A Meinel (jameinel)
Changed in juju:
importance: Undecided → High
assignee: nobody → Gabriel Samfira (gabriel-samfira)
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.