grpc: fix missing some early events#2333
Merged
BareosBot merged 18 commits intobareos:masterfrom Sep 16, 2025
Merged
Conversation
This was
linked to
issues
Jul 25, 2025
3131a3f to
2e8135b
Compare
3 tasks
If you did not quote your plugin names, they were getting parsed as identifiers, which the function did not accept. As such we just force strings during the parsing, which should fix this issue.
nullptr RestoreObjects are sent to every plugin, which will grpc to try to pass them to its child, even if it does not exist. Now these events are simply cached, so that the child can take care of them when it gets initialized. We should probably just drop these, as they dont really matter and might just confuse the plugin...
Plugins should only receive events that they registered for. So we need to make sure we respect that even for early events.
Make sure to reuse/free the object/name memory. Also enhance the restoreobject test. If the restoreobject was messed up, then python may throw an exception when we try to print it (i.e. when the object has internal zero bytes)! This is fixed by just printing everything in hex instead.
Also remove some defaults from the switches and handle sentinel values separately. This way its much easier to add new enum options.
Some early events actually have data, so we need to cache those as well. This also fixes an issue where we did not report the correct event size in some cases. The python code was also fixed: some types were set to the wrong python type, leading to repeated error messages about truncations.
d2af535 to
120d227
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to the Bareos Project!
The way that the grpc plugin (and the bareos bridge module) works, is that they only know their "child", once a certain step in the backup/restore process was reached.
This means they had no way to send events that were created before that point to the child, as it does not exist at that point.
This lead to the behaviour, where plugins run under grpc never knew that they were supposed to do an incremental backup.
This pr fixes this by caching "early" events, if the child does not exist yet, and then dispatching them at the first possible moment.
This pr also fixes the following:
TODO:
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality
Tests