Skip to content

Conversation

@krushnarout
Copy link
Member

await _walFile!.writeAsString(jsonString);

here crash happened because the wal file written many times at the same time, fixed it by allowing only one file save at a time

PathNotFoundException: Cannot open file, path = '/Users/AVK/Documents/wals.json' (OS Error: No such file or directory, errno = 2)

also fixed this by creating the directory before writing

@krushnarout krushnarout linked an issue Jan 13, 2026 that may be closed by this pull request
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a crash from concurrent file writes by serializing save operations and preventing re-entrant flushing. It also handles a PathNotFoundException by ensuring the target directory exists before writing. My review focuses on improving the new error handling logic. I've pointed out two places where exceptions are being swallowed, which could lead to silent failures and subsequent issues. Specifically, I've suggested re-throwing an exception after logging it in _flush to ensure callers are aware of failures, and to fail early in saveWals if directory creation is unsuccessful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlutterError - FileSystemException: Cannot open file

2 participants