-
Notifications
You must be signed in to change notification settings - Fork 520
Fixes Error - Uncaught Exception Error: write EIO #92 #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…th safeLogger calls
fs.mkdirSync(this.logDir, { recursive: true }) | ||
} | ||
} catch (error) { | ||
// Silently fail - we can't log the error since we're creating the logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should silently fail this - if this fails there is no way of figuring out what went wrong before or after
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right. If the log directory creation fails, we should at least attempt to use a fallback location or provide some indication of the failure. I'll update this to try a fallback directory and use stderr as a last resort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR - it is a good addition.
We can merge once the review is addressed
try { | ||
fs.appendFileSync(filePath, message, 'utf8') | ||
} catch (error) { | ||
// Silently fail - we can't use console.log here as it would cause the same issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silent failing is fine as everything would be in the log file already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this silent failing is appropriate here since if we can't write to the log file, using console.log would defeat the purpose and potentially cause the original EIO error we're trying to solve.
} | ||
}) | ||
} catch (error) { | ||
// Silently fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be logged normally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, since this would be called during normal operation (not during logger initialization), we can safely log this error using our own logging methods.
electron/SafeLogger.ts
Outdated
// Clean up old logs (optional - call this periodically) | ||
cleanupOldLogs(maxAgeDays: number = 7): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this called? I don't see any function calls
If it is user driven - how can a user call it?
If not we can make a path redirect where the user can go themselves and manually delete the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function isn't currently called anywhere. I'll either remove it entirely since users can manually manage log files, or if we want to keep it, I can add it as a startup routine that runs once when the app initializes. What would you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is wise to clear logs at session startup in case one needs to track past errors.
You could do any of the following:
- Give a button for log clearance
- Add a message in the initial dialog box with a redirect or a path name so users can do it manually
- Clear once a certain size limit is hit like 1 GB threshold (Put a message in the dialog box or the README) that the logs will clear after 1GB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is wise to clear logs at session startup in case one needs to track past errors.
yeah, you are right!
You could do any of the following:
- Give a button for log clearance
- Add a message in the initial dialog box with a redirect or a path name so users can do it manually
- Clear once a certain size limit is hit like 1 GB threshold (Put a message in the dialog box or the README) that the logs will clear after 1GB
Okay, I'm thinking of doing a combination of 2nd and 3rd by giving the option to delete it manually by redirecting to the logs directory and also implementing the deletion of logs once it hits 1 GB. I'll work on implementing this and will update ASAP!
stealth-run.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This shouldn't be a part of the diff - it gets automatically added when you run the application
I'll make the necessary changes and will commit soon |
- Add automatic log directory cleanup when exceeding 1GB in SafeLogger - Update WelcomeScreen with logs storage location for manual cleanup - Implement getDirectorySize() and cleanup methods for logs - Log cleanup actions for debugging purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Automatic Storage Management (1GB Cleanup)
Changes
- Logs: Auto-clear when log directory exceeds 1GB
- UI Updates: Added storage locations and cleanup info to WelcomeScreen and SettingsDialog
Implementation
SafeLogger.ts
: Added size checking and cleanup before writing logs- UI components updated to show file locations for manual cleanup
Testing
Tested manually by different methods like changing the directory size to 1 MB for testing, creating test cases for manual checking and creating a fake log file that exceeds 1GB by dd if=/dev/zero of=test-large.log bs=1024 count=1126400
and verifying the result manually.
Fixes storage accumulation issues while maintaining app functionality.
@bhaumikmaan, @Ornithopter-pilot, @us1415, @dev-opsss and @Anshumansingh01, please verify and merge. Thank you.
Note to self: integrate OpenAI's Whisper when free from placements |
@bhaumikmaan, Please approve when you get time |
./stealth-run.sh
script. The app won't even quit that time and will through errors whenever any of the shortcut keys were pressed.Now both the script and compiled app works as intended.
Error message was:
Attached is the video of error:
WhatsApp.Video.2025-07-22.at.15.41.49.mp4