Skip to content
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

various thread safety issues in the Liberty scheduled executor #15390

Closed
njr-11 opened this issue Dec 31, 2020 · 0 comments · Fixed by #15391
Closed

various thread safety issues in the Liberty scheduled executor #15390

njr-11 opened this issue Dec 31, 2020 · 0 comments · Fixed by #15391
Assignees
Labels
release bug This bug is present in a released version of Open Liberty release:21001 team:Zombie Apocalypse

Comments

@njr-11
Copy link
Contributor

njr-11 commented Dec 31, 2020

While making some updates (and adding some tests) to get the Liberty scheduled executor to run scheduled tasks via a policy executor, I came across a couple of thread safety bugs in the Liberty scheduled executor.

  1. Intermittent issue where canceling a repeating task sometimes doesn't actually cancel it. This happens because the mechanism for swapping out the m_schedFuture in SchedulingRunnableFixedHelper isn't thread safe. When requesting a cancel around the same time an execution is finishing and rescheduling, the cancel can be sent to the old, already-completed future rather than the future that represents the next scheduled execution.
  2. Intermittent issue where various ScheduledFuture operations encounter NullPointerException because m_schedFuture is initialized after the task is actually scheduled. There is no way to reverse the ordering because the scheduling produces the value to set. However, code can be updated to allow for the possibility of seeing a null m_schedFuture.

Another bug is that when a repeating task execution fails to submit to the executor, only the SchedulingHelper's latch is counted down, with the SchedulingRunnableFixedHelper remaining unaware. From the user's perspective, the future for the repeating scheduled task never shows as being done and get operations time out, even though the task has actually aborted and will never run again. This issue may have been hidden in the past because prior to usage with a policy executor, submits directly to the Liberty global executor tended to not raise exceptions.

@njr-11 njr-11 added the release bug This bug is present in a released version of Open Liberty label Dec 31, 2020
@njr-11 njr-11 self-assigned this Dec 31, 2020
njr-11 added a commit to njr-11/open-liberty that referenced this issue Dec 31, 2020
njr-11 added a commit to njr-11/open-liberty that referenced this issue Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release bug This bug is present in a released version of Open Liberty release:21001 team:Zombie Apocalypse
Projects
None yet
2 participants