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

Fix Watcher stats class cast exception #39821

Merged
merged 5 commits into from
Mar 8, 2019

Conversation

jasontedor
Copy link
Member

The watcher stats implementation tries to look at all queued watches before preparing the result. We want to cast these to a WatchExecutionTask to extract the context to prepare the stats for queued watches. The problem is that not all tasks on the watcher queue were WatchExecutionTask. This is because a manually executed watch was not even at all wrapped in a WatchExecutionTask. Moreover, we were using ExecutorService#submit(Runnable) which would wrap the Runnable in a FutureTask<?>. This commit addresses this by using a WatchExecutionTask, and also using ExecutorService#execute(Runnable) so that no wrapping occurs. This will let us continue with the assumption that all queued tasks are WatchExecutionTasks.

Closes #39780

The watcher stats implementation tries to look at all queued watches
before preparing the result. We want to cast these to a
WatchExecutionTask to extract the context to prepare the stats for
queued watches. The problem is that not all tasks on the watcher queue
were WatchExecutionTask. This is because a manually executed watch was
not even at all wrapped in a WatchExecutionTask. Moreover, we were using
ExecutorService#submit(Runnable) which would wrap the Runnable in a
FutureTask<?>. This commit addresses this by using a WatchExecutionTask,
and also using ExecutorService#execute(Runnable) so that no wrapping
occurs. This will let us continue with the assumption that all queued
tasks are WatchExecutionTasks.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

* elastic/master:
  Add pre-upgrade check to test cluster routing allocation is enabled (elastic#39340)
  Update logstash-management.json to use typeless template (elastic#38653)
  Small simplifications to mapping validation. (elastic#39777)
  Update distribution build instructions to reflect file names with OS/architecture classifiers. (elastic#39762)
  Give jspawnhelper execute permissions in bundled JDK (elastic#39787)
  Maintain step order for ILM trace logging (elastic#39522)
  [ML-DataFrame] fix wire serialization issues in data frame response objects (elastic#39790)
  fix index refresh in test within 20_mix_typeless_typeful (elastic#39198)
  Combine overriddenOps and skippedOps in translog (elastic#39771)
@jbaiera jbaiera self-requested a review March 8, 2019 16:14
@jbaiera
Copy link
Member

jbaiera commented Mar 8, 2019

LGTM

@jasontedor jasontedor merged commit 1095e10 into elastic:master Mar 8, 2019
jasontedor added a commit that referenced this pull request Mar 8, 2019
The watcher stats implementation tries to look at all queued watches
before preparing the result. We want to cast these to a
WatchExecutionTask to extract the context to prepare the stats for
queued watches. The problem is that not all tasks on the watcher queue
were WatchExecutionTask. This is because a manually executed watch was
not even at all wrapped in a WatchExecutionTask. Moreover, we were using
ExecutorService#submit(Runnable) which would wrap the Runnable in a
FutureTask<?>. This commit addresses this by using a WatchExecutionTask,
and also using ExecutorService#execute(Runnable) so that no wrapping
occurs. This will let us continue with the assumption that all queued
tasks are WatchExecutionTasks.
jasontedor added a commit that referenced this pull request Mar 8, 2019
The watcher stats implementation tries to look at all queued watches
before preparing the result. We want to cast these to a
WatchExecutionTask to extract the context to prepare the stats for
queued watches. The problem is that not all tasks on the watcher queue
were WatchExecutionTask. This is because a manually executed watch was
not even at all wrapped in a WatchExecutionTask. Moreover, we were using
ExecutorService#submit(Runnable) which would wrap the Runnable in a
FutureTask<?>. This commit addresses this by using a WatchExecutionTask,
and also using ExecutorService#execute(Runnable) so that no wrapping
occurs. This will let us continue with the assumption that all queued
tasks are WatchExecutionTasks.
jasontedor added a commit that referenced this pull request Mar 8, 2019
The watcher stats implementation tries to look at all queued watches
before preparing the result. We want to cast these to a
WatchExecutionTask to extract the context to prepare the stats for
queued watches. The problem is that not all tasks on the watcher queue
were WatchExecutionTask. This is because a manually executed watch was
not even at all wrapped in a WatchExecutionTask. Moreover, we were using
ExecutorService#submit(Runnable) which would wrap the Runnable in a
FutureTask<?>. This commit addresses this by using a WatchExecutionTask,
and also using ExecutorService#execute(Runnable) so that no wrapping
occurs. This will let us continue with the assumption that all queued
tasks are WatchExecutionTasks.
@jasontedor
Copy link
Member Author

Thanks for looking @jbaiera.

@jasontedor jasontedor deleted the watcher-stats-cce branch March 8, 2019 20:19
@Mpdreamz
Copy link
Member

++ just hit this on our client CI as well. Always a joy to see it fixed before reporting 😄

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.

ClassCastException returned when calling Watcher Stats API endpoint
5 participants