Crash while checkpointing due to fs.* errors
- Dominant language
- JavaScript
- Stars
- 198
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
If a `.city` file is removed while the server is preparing to checkpoint, it will cause the server to crash before the checkpoint is performed:
```
Checkpoint 2021-03-02T11.48.19.274Z.city complete.
Checkpointing...
internal/fs/utils.js:220
throw err;
^
Error: ENOENT: no such file or directory, stat '2021-03-02T10.11.40.306Z.city'
at Object.statSync (fs.js:915:3)
at Object.CodeCity.fileSize (/Users/cpcallen/src/CodeCity/server/codecity:286:13)
at Object.CodeCity.deleteCheckpointsIfNeeded (/Users/cpcallen/src/CodeCity/server/codecity:207:16)
at Timeout.CodeCity.checkpoint [as _onTimeout] (/Users/cpcallen/src/CodeCity/server/codecity:296:12)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '2021-03-02T10.11.40.306Z.city'
}
```
The checkpointing code should have some `try {…} catch {…}`es added so that it will not have a fit if a file disappears out from it or there are otherwise errors (e.g. in writing).
Just not checkpointing at all is preferable to crashing.
Contributor guide
Assessment
This issue has not been assessed yet.