director: fix crash in status scheduler when client is not set#965
director: fix crash in status scheduler when client is not set#965
Conversation
arogge
left a comment
There was a problem hiding this comment.
While this patch fixes the crash, it will make status scheduler behave in a way that I would not expect. So it is probably not a good idea to do it this way.
Maybe we could improve the job object to have a function is_client_enabled() that could handle it. That function could look like this:
bool is_client_enabled() {
return client != nullptr && client->enabled;
}
This would return false if client is set and not enabled, but true in every other case including client not being set.
arogge
left a comment
There was a problem hiding this comment.
Just tried with your changes.
Configured a copy-job with a disabled client and ran status scheduler job=copy.
Threw the direcotor in an infinite loop eating CPU, so something is obviously still broken.
4d7c3c4 to
9c7f956
Compare
9c7f956 to
238987e
Compare
238987e to
0caa435
Compare
arogge
left a comment
There was a problem hiding this comment.
in ua_status.cc we have lines 658 to 716 with 7 empty or comment lines.
That's a net amount of 51 lines of code.
These contain:
- 16 branches (14
ifs, 2elses) - 3 loops (1
while, 2foreach_res) - 9 jumps (3
gotos, 5continues, 1break)
So there is a loop, branch or some other kind of jump every 2 lines.
What I'm trying to say is: I would love to review the code, but I need to understand it.
Don't you think this should be refactored completely so we can understand what is going on without drawing a complex diagram?
0caa435 to
cc31ee0
Compare
updated scheduler-backup systemtest to comply to substest format
cc31ee0 to
0aaea07
Compare
The commits with the changes do not exist anymore
Thank you for contributing to the Bareos Project!
The
status schedulercommand did not check thejob->clientpointer before dereferencing. This is fixed with this PR.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)
General
Source code quality
bareos-check-sources --since-mergedoes not report any problemsgit statusshould not report modifications in the source tree after building and testing