You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "rbankar7 (via GitHub)" <gi...@apache.org> on 2026/08/09 14:02:18 UTC

[I] Composing emitter re-resolves child emitters from Guice on every event, causing lock contention (druid)

rbankar7 opened a new issue, #19943:
URL: https://github.com/apache/druid/issues/19943

   ### Description
   
   When `druid.emitter=composing` is configured, the composing emitter resolves its child emitters from the Guice injector on **every** emitted event instead of once at startup. Since Druid emits a metric per segment scanned, this runs tens of thousands of times per second on busy nodes, and each resolution takes a monitor lock.
   
   Lock profiling attributed the large majority of lock-contention samples to `LifecycleScope$1.get`.
   
   ### Root cause
   
   `ComposingEmitterModule#getEmitter` builds the child-emitter list with `Lists.transform(...)`, which returns a **lazy** Guava view. `ComposingEmitter.emit(Event)` iterates that list per event, so each iteration re-runs the transform and re-resolves every child via `injector.getInstance(...)`. For lifecycle-scoped bindings this goes through `LifecycleScope#get()`, which is `synchronized` and takes a monitor lock on every call — even though after startup it just returns a cached instance.
   
   ### Fix
   
   Resolve the child emitters eagerly, once, into a materialized `ImmutableList` at construction time, matching how `SwitchingEmitterModule` already builds its child-emitter lists. No behavior change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [I] Composing emitter re-resolves child emitters from Guice on every event, causing lock contention (druid)

Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 closed issue #19943: Composing emitter re-resolves child emitters from Guice on every event, causing lock contention
URL: https://github.com/apache/druid/issues/19943


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org