Skip to content

Conversation

@DivineThreepwood
Copy link
Member

📜 Description

Changes proposed in this pull request:

  • fix potential deadlock between actionDescriptionBuilderLock and actionTaskLock in ActionImpl.
  • make sure reschedule is not triggered once the unit controller is shutting down to avoid lots of exceptions.
  • Make sure required state observer is shutdown in case the scene state changes to not interfere with future scene activations. Improve required state validation by filtering by validate the initial action to avoid scene cancelation based on an outdated action. Minor typo fixes.
  • fix logic issue in equalServiceStates check.
  • Implement validateInitialAction service method for Actions.
  • Make sure remote action cleanup task does not cleanup the state of other actions that are later observed by the same remote instance, by canceling the cleanup task once the remote is reinitialized.
  • make sure remote action list is always locked once accessed.
  • Code readability improvements.
  • clearly define start and end of an bco test to enable the separation of test prints vs. setup / cleanup prints.
  • improve test logging.

… changes to not interfear with future scene activations. Improve required state validation by filtering by validate the initial action to avoid scene cancelation based on an outdated action. Minor typo fixes.
…her actions that are later observed by the same remote instance, by canceling the cleanup task once the remote is reinitialized.
…pipeline_deadlocks_and_other_pipeline_issues
@DivineThreepwood DivineThreepwood added preview Auto build a docker image and deploy it as a preview version. and removed preview Auto build a docker image and deploy it as a preview version. labels Dec 11, 2022
Copy link
Contributor

@pLeminoq pLeminoq left a comment

Choose a reason for hiding this comment

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

Overall, a really nice PR. I just have suggestions for a few minor changes and I think the actionTask issue has to be discussed.

Comment on lines 71 to 73

// any code that accesses the data lock while holding the action task lock should previously lock the data lock.
// otherwise deadlocks can occur.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is not entirely clear to me, especially with regard to the proposed change below. There are two possibilities:

  1. We always need to acquire the data lock if we need the the action task lock and the data lock has to be acquired first.
  2. We don't need to acquire the data lock in every case we need the action task look. But if we do, the data lock has to be acquired first.

I think you mean option 2. But in light of the proposed change below, this is not easily visible since the requirement to acquire the data lock is hidden in the isTerminating() call.

In general, I think the usage of such a comment is sub-optimal as you will not see this comment during coding. Would it be possible to implement a structure where when you acquire the action task lock, you have to consciously decide if you also need to acquire the data lock?

}

// register an observer which will deactivate the scene if one required action is now longer running
// observer will cleanup itself after the action is no longer valid so no need to care fore it.
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the second line of this comment is now outdated and should be removed.


private void verifyAllStates() {
try {
// logger.trace("verify "+unitAndRequiredServiceStateMap.entrySet().size()+ " states of "+ getLabel("?"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove commented debug log

@Override
public void update(ServiceStateProvider<Message> serviceStateProvider, Message serviceState) throws Exception {
try {
// logger.error("Incomming service state update from "+ serviceStateProvider.getServiceProvider().getId() + " triggered from "+ serviceState.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove commented log

Comment on lines +1229 to +1235
if (description == null && actionReference != null) {
description = ActionDescriptionProcessor.toString(actionReference);
}

// resolve via parameter
if (actionParameter != null) {
return ActionDescriptionProcessor.toString(actionParameter);
}
// resolve via parameter
if (description == null && actionParameter != null) {
description = ActionDescriptionProcessor.toString(actionParameter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the description is set to an empty string above you description.isEmpty() should be used instead of the null checks.


LOGGER.warn("turn off...");
waitForExecution(sceneRemoteOff.setActivationState(State.ACTIVE, SCENE_ACTION_PARAM));
LOGGER.warn("turn off... continue");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these debugging logs still required?

…layer/unit/scene/SceneControllerImpl.java

Co-authored-by: pLeminoq <thuxohl@techfak.uni-bielefeld.de>
@DivineThreepwood DivineThreepwood removed the preview Auto build a docker image and deploy it as a preview version. label Dec 13, 2022
@DivineThreepwood
Copy link
Member Author

Thanks for the detailed review. All conversations are addressed, so PR is ready to review again.

@DivineThreepwood DivineThreepwood merged commit fa3cc42 into dev Dec 14, 2022
@DivineThreepwood DivineThreepwood deleted the bugfix/#69_fix_action_pipeline_deadlocks_and_other_pipeline_issues branch December 14, 2022 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

3 participants