partial file writes on power loss
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/
A PR for this has been proposed at:
Changed in juju: | |
importance: | Undecided → High |
assignee: | nobody → Gabriel Samfira (gabriel-samfira) |
Changed in juju: | |
status: | Fix Committed → Fix Released |
Juju PR against develop (2.2): https:/ /github. com/juju/ juju/pull/ 7358