Code of Conduct
Search before asking
Describe the bug
KyuubiOperation#setState updates operation state metrics before the actual state transition is validated and applied by AbstractOperation#setState.
Current flow:
override def setState(newState: OperationState): Unit = {
MetricsSystem.tracing { ms =>
if (!OperationState.isTerminal(state)) {
ms.markMeter(MetricRegistry.name(OPERATION_STATE, opType, state.toString.toLowerCase), -1)
}
ms.markMeter(MetricRegistry.name(OPERATION_STATE, opType, newState.toString.toLowerCase))
ms.markMeter(MetricRegistry.name(OPERATION_STATE, newState.toString.toLowerCase))
}
super.setState(newState)
}
This can make operation state metrics inconsistent with the real operation state.
There are two related problems:
- If
AbstractOperation#setState rejects a stale or invalid transition, metrics may already have been updated.
- Concurrent state transitions for the same operation are not protected as one atomic transition-and-metrics-update sequence, so multiple threads may update metrics based on the same stale old state.
Affects Version(s)
master
Kyuubi Server Log Output
Kyuubi Engine Log Output
Kyuubi Server Configurations
Kyuubi Engine Configurations
Additional context
No response
Are you willing to submit PR?
Code of Conduct
Search before asking
Describe the bug
KyuubiOperation#setStateupdates operation state metrics before the actual state transition is validated and applied byAbstractOperation#setState.Current flow:
This can make operation state metrics inconsistent with the real operation state.
There are two related problems:
AbstractOperation#setStaterejects a stale or invalid transition, metrics may already have been updated.Affects Version(s)
master
Kyuubi Server Log Output
Kyuubi Engine Log Output
Kyuubi Server Configurations
Kyuubi Engine Configurations
Additional context
No response
Are you willing to submit PR?