Skip to content
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

Fix for #1491 (error user callback not called sometimes) and #489 (killing rsync not handled gracefully / rsync exit code not evaluated) #1502

Merged
merged 11 commits into from
Aug 17, 2023

Conversation

aryoda
Copy link
Contributor

@aryoda aryoda commented Aug 16, 2023

Notes

I did only apply required changes to fix the issues since the takeSnapshot() function is the "heart" of BiT
and has a quite complicated logic (many ifs, legacy parameter passing with tuples instead of named classes etc.).

Still I have added a lot of TODOs, comments and docstrings to make the logic better understandable (I hope).

Testing

I have done many manual tests & debugging with different signals, rsync errors and with and without the Take a new snapshot whether there were changes or not option.

The unit tests do succeed (make test) on my local machine.

aryoda added 10 commits July 22, 2023 22:52
Fix bug: Taking a snapshot reports `rsync` errors now even if no snapshot was taken (#1491)
Fix bug: takeSnapshot() recognizes errors now by also evaluating the rsync exit code (#489)
         Fixes related problem: Killing `rsync` was not handled gracefully (by ignoring the rsync exit code)
Fix bug: The error user-callback is now always called if an error happened during taking a snapshot (#1491)
Improvement: Introduce new error codes for the "error" user callback (as part of #1491):
             5: Error while taking a snapshot.
             6: New snapshot taken but with errors.
Improvement: The `rsync` exit code is now contained in the snapshot log. Example:
             [E] Error: 'rsync' ended with exit code -9 (negative values are signal numbers, see 'kill -l')
CHANGES Outdated
* Fix bug: takeSnapshot() recognizes errors now by also evaluating the rsync exit code (#489)
Fixes related problem: Killing `rsync` was not handled gracefully (by ignoring the rsync exit code)
* Fix bug: The error user-callback is now always called if an error happened during taking a snapshot (#1491)
* Improvement: Introduce new error codes for the "error" user callback (as part of #1491):
Copy link
Member

Choose a reason for hiding this comment

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

Based on changelog standards I would name this a "Feature".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you still found the link to the changelog standards (I have lost oversight here).

I would like to add it at the top of the changelog file keep it "in sight" whenever I change the changelog...

Copy link
Member

@buhtz buhtz Aug 17, 2023

Choose a reason for hiding this comment

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

In my own projects where I also decided to write markdown changelog I do use

I didn't want to bother you folks with that details. And myself I'm also quit new to handling things like this. So I'm still in experimenting period and try out what fits best to me.

While getting in touch with that standards I also read about auto-generating changelogs from git commit history. But I don't like that approach because the target readers for commit messages and changelog messages are IMHO different. The first is more technical based and the latter should focus on behavior of the application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -91,14 +91,19 @@ def error(self, code, message):

Known error codes:

1. No or no valid configuration
1: No or no valid configuration
Copy link
Member

Choose a reason for hiding this comment

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

I assume that new codes should be mentioned in the user-callback repo also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I forgot to update the README.md there!

I will update this too today

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -129,6 +129,24 @@ def takeSnapshotMessage(self):

#TODO: make own class for takeSnapshotMessage
def setTakeSnapshotMessage(self, type_id, message, timeout = -1):
"""Update the status message of the active snapshot creation job
Copy link
Member

Choose a reason for hiding this comment

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

Awesome. Never really get what this function does! 🤣

if ret_error:
logger.error('New snapshot taken but errors detected', self)
self.config.PLUGIN_MANAGER.error(6, sid.displayID) # Fixes #1491
ret_error = False # Why ignore errors now?
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about this but your arguments sounds fine to me.

@buhtz
Copy link
Member

buhtz commented Aug 17, 2023

Thanks a lot for that work and all the comments and improved docu. This will help a lot in the future.

@aryoda aryoda changed the title Fix for #1491 (error user callback not called sometimes) and #489 (Killing rsync not handled gracefully / rsync exit code not evaluated) Fix for #1491 (error user callback not called sometimes) and #489 (killing rsync not handled gracefully / rsync exit code not evaluated) Aug 17, 2023
@aryoda aryoda merged commit 976081b into bit-team:dev Aug 17, 2023
1 check passed
@aryoda aryoda mentioned this pull request Aug 17, 2023
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.

2 participants