Skip to content

Commit 91a56dc

Browse files
committed
<fix>[thread]: guard Context.current() with telemetry check
SyncTaskFuture constructor calls Context.current() unconditionally, triggering ServiceLoader for ContextStorageProvider even when telemetry is disabled. If sentry-opentelemetry-bootstrap jar is on classpath, ServiceLoader fails with "not a subtype" due to ClassLoader isolation in Tomcat, throwing ServiceConfigurationError (extends Error) that escapes all catch(Exception) blocks. 1. Why is this change necessary? MN startup crashes with ORG_ZSTACK_CORE_WORKFLOW_10001 because Context.current() triggers ServiceLoader unconditionally in SyncTaskFuture constructor, even when telemetry is disabled. 2. How does it address the problem? Only call Context.current() when isTelemetryEnabled() returns true, matching the existing guard pattern used in other DispatchQueueImpl code paths (lines 351, 1069). 3. Are there any side effects? None. When telemetry is disabled, parentContext was never used. # Summary of changes (by module): - core/thread: conditionalize Context.current() in SyncTaskFuture Related: ZSTAC-82274 Change-Id: I8ae1f790c8591ae7acebd011319878eb824d2fb0
1 parent ba18569 commit 91a56dc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core/src/main/java/org/zstack/core/thread/DispatchQueueImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private class SyncTaskFuture<T> extends AbstractFuture<T> {
302302

303303
public SyncTaskFuture(SyncTask<T> task) {
304304
super(task);
305-
this.parentContext = Context.current();
305+
this.parentContext = isTelemetryEnabled() ? Context.current() : null;
306306
}
307307

308308
private SyncTask getTask() {

0 commit comments

Comments
 (0)