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

Druid moving average query results in circular reference error #7999

Closed
bjornm82 opened this issue Jun 30, 2019 · 4 comments · Fixed by #8192
Closed

Druid moving average query results in circular reference error #7999

bjornm82 opened this issue Jun 30, 2019 · 4 comments · Fixed by #8192
Milestone

Comments

@bjornm82
Copy link

bjornm82 commented Jun 30, 2019

Moving average query extension results in circular references.

Affected Version

0.15.0-incubating

Description

Steps to reproduce

Checkout branch 0.15.0-incubating
Build mvn clean package in extensions-contrib/moving-average-query
Add jar to extensions/druid-moving-average-query
Add druid.extensions.loadList=["druid-moving-average-query"]
Run broker with runtime.properties of broker

  • The error message or stack traces encountered.
    When running the broker with the contrib extension moving-average-query following error occurs:
2019-06-30T09:14:03,832 ERROR [main] org.apache.druid.cli.CliBroker - Error when starting up.  Failing.
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.IllegalStateException: This is a proxy used to support circular references. The object we're proxying is not constructed yet. Please wait until after injection has completed to use this object.
  at org.apache.druid.client.CachingClusteredClient.<init>(CachingClusteredClient.java:115)
  at org.apache.druid.cli.CliBroker.lambda$getModules$0(CliBroker.java:94) (via modules: com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.apache.druid.cli.CliBroker$$Lambda$8/1493042329)
  while locating org.apache.druid.client.CachingClusteredClient
    for the 2nd parameter of org.apache.druid.server.ClientQuerySegmentWalker.<init>(ClientQuerySegmentWalker.java:68)
  while locating org.apache.druid.server.ClientQuerySegmentWalker
  at org.apache.druid.cli.CliBroker.lambda$getModules$0(CliBroker.java:107) (via modules: com.google.inject.util.Modules$OverrideModule -> com.google.inject.util.Modules$OverrideModule -> org.apache.druid.cli.CliBroker$$Lambda$8/1493042329)
  while locating org.apache.druid.query.QuerySegmentWalker
  at org.apache.druid.query.movingaverage.MovingAverageQueryToolChest.<init>(MovingAverageQueryToolChest.java:61)
  at org.apache.druid.query.movingaverage.MovingAverageQueryModule.configure(MovingAverageQueryModule.java:48) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.movingaverage.MovingAverageQueryModule)
  while locating org.apache.druid.query.movingaverage.MovingAverageQueryToolChest
  while locating org.apache.druid.query.QueryToolChest annotated with @com.google.inject.multibindings.Element(setName=,uniqueId=136, type=MAPBINDER, keyType=java.lang.Class<? extends org.apache.druid.query.Query>)
  at org.apache.druid.guice.DruidBinders.queryToolChestBinder(DruidBinders.java:47) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.query.movingaverage.MovingAverageQueryModule -> com.google.inject.multibindings.MapBinder$RealMapBinder)
  while locating java.util.Map<java.lang.Class<? extends org.apache.druid.query.Query>, org.apache.druid.query.QueryToolChest>
    for the 1st parameter of org.apache.druid.query.MapQueryToolChestWarehouse.<init>(MapQueryToolChestWarehouse.java:35)
  while locating org.apache.druid.query.MapQueryToolChestWarehouse
  while locating org.apache.druid.query.QueryToolChestWarehouse
    for the 1st parameter of org.apache.druid.client.BrokerServerView.<init>(BrokerServerView.java:98)
  at org.apache.druid.client.BrokerServerView.class(BrokerServerView.java:63)
  while locating org.apache.druid.client.BrokerServerView

1 error
	at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1028) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1050) ~[guice-4.1.0.jar:?]
	at org.apache.druid.guice.LifecycleModule$2.start(LifecycleModule.java:138) ~[druid-core-0.15.0-incubating.jar:0.15.0-incubating]
	at org.apache.druid.cli.GuiceRunnable.initLifecycle(GuiceRunnable.java:106) [druid-services-0.15.0-incubating.jar:0.15.0-incubating]
	at org.apache.druid.cli.ServerRunnable.run(ServerRunnable.java:57) [druid-services-0.15.0-incubating.jar:0.15.0-incubating]
	at org.apache.druid.cli.Main.main(Main.java:118) [druid-services-0.15.0-incubating.jar:0.15.0-incubating]
Caused by: java.lang.IllegalStateException: This is a proxy used to support circular references. The object we're proxying is not constructed yet. Please wait until after injection has completed to use this object.
	at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[guava-16.0.1.jar:?]
	at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:36) ~[guice-4.1.0.jar:?]
	at com.sun.proxy.$Proxy88.registerSegmentCallback(Unknown Source) ~[?:?]
	at org.apache.druid.client.CachingClusteredClient.<init>(CachingClusteredClient.java:131) ~[druid-server-0.15.0-incubating.jar:0.15.0-incubating]
	at org.apache.druid.client.CachingClusteredClient$$FastClassByGuice$$bc7211e6.newInstance(<generated>) ~[druid-server-0.15.0-incubating.jar:0.15.0-incubating]
	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) ~[guice-4.1.0.jar:?]
	at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015) ~[guice-4.1.0.jar:?]
	at org.apache.druid.query.movingaverage.MovingAverageQueryToolChest.<init>(MovingAverageQueryToolChest.java:63) ~[?:?]
	at org.apache.druid.query.movingaverage.MovingAverageQueryToolChest$$FastClassByGuice$$567de849.newInstance(<generated>) ~[?:?]
	at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89) ~[guice-4.1.0.jar:?]
bash-4.4# mvn --version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /usr/share/java/maven-3
Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: /opt/jdk1.8.0_202/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.125-linuxkit", arch: "amd64", family: "unix"

@yurmix or @jihoonson any of you know what happens here or what I need to do?

@yurmix
Copy link
Contributor

yurmix commented Jul 1, 2019

Thank you, I was able to reproduce it, I will investigate.

BTW, I didn't have to build the package, downloading it was sufficient:

cd apache-druid-0.15.0-incubating
java -classpath "lib/*" org.apache.druid.cli.Main tools pull-deps -c org.apache.druid.extensions.contrib:druid-moving-average-query:0.15.0-incubating

@yurmix
Copy link
Contributor

yurmix commented Jul 1, 2019

I have tested loading materialized-view-selection, since it is another contrib extension which extends the Query extension points. That extension didn't have an issue loading, so I will use that in my investigation.

@bjornm82
Copy link
Author

bjornm82 commented Jul 1, 2019

Alright! Thanks @yurmix. I quickly glanced at the code and would take me quite some time to figure out the problem. I can also take a look at the materialized-view-selection tomorrow, might be able to help.

@yurmix
Copy link
Contributor

yurmix commented Jul 19, 2019

@jihoonson looks like MovingAverageQueryToolChest is being injected before its dependencies (ClientQuerySegmentWalker, CachingClusteredClient), do you know if there is perhaps a way to control the injection order here through an annotation?
https://github.com/apache/incubator-druid/blob/6bd51fa8f5f183770d8ea128b02bc18fa92fa387/extensions-contrib/moving-average-query/src/main/java/org/apache/druid/query/movingaverage/MovingAverageQueryToolChest.java#L60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants