Skip to content

plugins: fix cancel handling crash#1595

Merged
BareosBot merged 14 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-cancel-handling-crash
Dec 22, 2023
Merged

plugins: fix cancel handling crash#1595
BareosBot merged 14 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-cancel-handling-crash

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Nov 13, 2023

Thank you for contributing to the Bareos Project!

The plugin context is not explicitly set when handling plugin events. This is fine for all events except for the cancel event, since the cancel event is issued on seperate threads (and the plugin context is stored in a thread local variable).

This PR fixes the crash by setting the plugin context whenever an event needs to be handled.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

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-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
    Check backport line
  • Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@sebsura sebsura force-pushed the dev/ssura/master/fix-cancel-handling-crash branch from fec50f9 to 8d3bd61 Compare November 13, 2023 10:44
@sebsura sebsura marked this pull request as draft November 16, 2023 11:11
@sebsura sebsura added the draft label Nov 16, 2023
@sebsura sebsura force-pushed the dev/ssura/master/fix-cancel-handling-crash branch 4 times, most recently from 4dbd0bd to f4819ec Compare November 21, 2023 12:04
@bruno-at-bareos
Copy link
Contributor

Tested cancel during file/dir building ok and also during backuping file ... all ok with nice backlog.
FD reacting correctly afterwards

@sebsura sebsura force-pushed the dev/ssura/master/fix-cancel-handling-crash branch 2 times, most recently from 03a0506 to d28a63e Compare November 28, 2023 12:41
@sebsura sebsura added bugfix and removed draft labels Nov 28, 2023
@sebsura sebsura marked this pull request as ready for review November 28, 2023 12:45
@sebsura sebsura force-pushed the dev/ssura/master/fix-cancel-handling-crash branch from d28a63e to 034d5e7 Compare December 13, 2023 07:30
Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

I have a few open questions and some change-requests for the python test-plugin.

@sebsura
Copy link
Contributor Author

sebsura commented Dec 21, 2023

I was notified of a problem in regards with this pull request. Ill request a rereview once I fixed the it.

@sebsura sebsura requested a review from arogge December 22, 2023 10:22
Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

That looks great. Thank you!

@sebsura sebsura force-pushed the dev/ssura/master/fix-cancel-handling-crash branch from f96eed2 to d933d5d Compare December 22, 2023 13:38
@sebsura sebsura mentioned this pull request Dec 22, 2023
13 tasks
Each seperate thread needs its own python thread state to do things
inside of python.
The new test tries to cancel the job while the job is inside the
plugin module.  This is to check whether there are any crashes.
This allows us to test what happens if the plugin finishes the backup
while the cancelation is still ongoing.
This prevents the situation where one thread is still trying to cancel
something while another is already destroying parts of the jcr.
@BareosBot BareosBot force-pushed the dev/ssura/master/fix-cancel-handling-crash branch from 5287c26 to aa43c0b Compare December 22, 2023 16:17
@BareosBot BareosBot merged commit 57b632d into bareos:master Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants