Skip to content

*#Stop(): wait for own Checkable#ProcessCheckResult() to finish🏁 #10397

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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Mar 28, 2025

This is the very first and hardest step of the #10179 (comment) plan.

Checkable#ProcessCheckResult() now takes a CheckResultProducer::Ptr:

  • 23c2365 Checkable#ProcessCheckResult(): discard CR or delay its producers shutdown

It tries to shared-lock the CheckResultProducer:

  • Failure means the CheckResultProducer indicates it's already shutting down, so the not yet really started Checkable#ProcessCheckResult() fails and discards the CR
  • Success means Checkable#ProcessCheckResult() can continue and on shutdown CheckResultProducer will wait for that

This implies that every component producing checks needs to implement CheckResultProducer:

  • f86b8ba *#Stop(): wait for own Checkable#ProcessCheckResult()s to finish
  • 84cb9d8 mkclass: inherit from Object like this: class T : virtual public Object

Finally, the CheckResultProducer::Ptr has "just" to be passed through from the CheckResultProducer itself to Checkable#ProcessCheckResult():

  • a06b01a Unconditionally allow processing CheckResults in tests
  • 3cbcbde LivestatusQuery#Execute(): take CheckResultProducer::Ptr
  • 199de23 LivestatusQuery#ExecuteCommandHelper(): take CheckResultProducer::Ptr
  • 8991f33 ExternalCommandProcessor::ProcessFile(): take CheckResultProducer::Ptr
  • 2c0b7cb ExternalCommandProcessor::ExecuteFromFile(): take CheckResultProducer::Ptr
  • 8b6ee1c ExternalCommandProcessor::Execute(): take CheckResultProducer::Ptr
  • f621b06 ExternalCommandProcessor::RegisterCommand(): allow callback to take a CheckResultProducer::Ptr
  • ec00100 ExternalCommandProcessor::Process*CheckResult(): take CheckResultProducer::Ptr
  • efce6ab ClusterEvents::ExecuteCheckFromQueue(): take ApiListener::Ptr
  • 21846f8 Checkable#ExecuteCheck(): take CheckResultProducer::Ptr
  • 3492279 CheckCommand#Execute(): take CheckResultProducer::Ptr
  • c35f558 IcingadbCheck::ScriptFunc(): take CheckResultProducer::Ptr
  • 5953a2a IdoCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 9f1edd3 SleepCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • eb415bd RandomCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 4976fe6 PluginCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 2eb535c NullCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 69bb267 IfwApiCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • eef64e2 IcingaCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • b3fcfb2 ExceptionCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 9164858 DummyCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 628353d ClusterZoneCheckTask::ScriptFunc(): take CheckResultProducer::Ptr
  • 7016920 ClusterCheckTask::ScriptFunc(): take CheckResultProducer::Ptr

This allows .ti classes multiple inheritance from Object.
@Al2Klimov Al2Klimov self-assigned this Mar 28, 2025
@cla-bot cla-bot bot added the cla/signed label Mar 28, 2025
@julianbrost
Copy link
Contributor

Well, that's indeed necessary.

@julianbrost rather agreed with #10179 (comment), but said #10179 (comment) lacks some tracking.

Interesting that I've said something about a comment I haven't even seen until just now.

@Al2Klimov Al2Klimov force-pushed the activation-priority-10179 branch from ce0d035 to 5b1c4b5 Compare March 31, 2025 14:04
@Al2Klimov Al2Klimov changed the title WIP 🚧 🚧WIP: CheckerComponent#Stop(): wait for own Checkable#ProcessCheckResult() to finish Mar 31, 2025
@Al2Klimov Al2Klimov requested a review from Copilot March 31, 2025 14:06
Copilot

This comment was marked as spam.

@Al2Klimov
Copy link
Member Author

@julianbrost Very funny. Fact is, on Thursday you

  1. agreed with me that components should stop/join their own checks along with themselves
  2. said that will need some tracking

So I've done that. So far:

  • 684ca7d Now Checkable#ProcessCheckResult() doesn't guess the CR origin, instead it demands a CheckResultProducer barely fitting into a std::shared_lock
  • a8d011f CheckerComponent implements that CheckResultProducer (TODO(@Al2Klimov): more classes)

Finally, CheckResultProducer::Ptr just has to be passed through.

@Al2Klimov Al2Klimov force-pushed the activation-priority-10179 branch 3 times, most recently from a0ad767 to a06b01a Compare April 3, 2025 09:09
@Al2Klimov Al2Klimov changed the title 🚧WIP: CheckerComponent#Stop(): wait for own Checkable#ProcessCheckResult() to finish CheckerComponent#Stop(): wait for own Checkable#ProcessCheckResult() to finish Apr 3, 2025
@Al2Klimov Al2Klimov changed the title CheckerComponent#Stop(): wait for own Checkable#ProcessCheckResult() to finish *#Stop(): wait for own Checkable#ProcessCheckResult() to finish Apr 3, 2025
@Al2Klimov Al2Klimov marked this pull request as ready for review April 3, 2025 10:30
@Al2Klimov Al2Klimov changed the title *#Stop(): wait for own Checkable#ProcessCheckResult() to finish *#Stop(): wait for own Checkable#ProcessCheckResult() to finish🏁 Apr 3, 2025
@Al2Klimov Al2Klimov force-pushed the activation-priority-10179 branch from ea36975 to a06b01a Compare April 7, 2025 09:53
@Al2Klimov Al2Klimov marked this pull request as draft April 7, 2025 10:56
@Al2Klimov Al2Klimov marked this pull request as ready for review April 7, 2025 12:44
@Al2Klimov Al2Klimov removed their assignment Apr 7, 2025
@Al2Klimov Al2Klimov force-pushed the activation-priority-10179 branch from 72a171d to 4873a34 Compare April 7, 2025 12:44
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.

2 participants