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

Bug fix @DruidSecondaryModule plus unit test #1245

Merged
merged 1 commit into from
Mar 26, 2015

Conversation

b-slim
Copy link
Contributor

@b-slim b-slim commented Mar 26, 2015

This PR has a fix and unit test to catch the bug.
The bug will raise when a module use the JsonConfigurator while the Guice built in .asEagerSingleton() start for ObjectMapper did not initialize it yet.

Caused by: java.lang.IllegalStateException: No 'injectableValues' configured, can not inject value with id [java.lang.String]
    at com.fasterxml.jackson.databind.DeserializationContext.findInjectableValue(DeserializationContext.java:291)
    at com.fasterxml.jackson.databind.deser.impl.ValueInjector.findValue(ValueInjector.java:46)
    at com.fasterxml.jackson.databind.deser.impl.ValueInjector.inject(ValueInjector.java:52)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.injectValues(BeanDeserializerBase.java:1237)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:290)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:124)
    at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2769)
    at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2700)
    at io.druid.guice.JsonConfigurator.configurate(JsonConfigurator.java:81)
    at io.druid.guice.JsonConfigProvider.get(JsonConfigProvider.java:181)
    at io.druid.guice.JsonConfigProvider.get(JsonConfigProvider.java:60)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at 

@drcrallen
Copy link
Contributor

Hi @b-slim , thanks for the PR.

Which of the test fails in master? Nevermind, there's only one

@drcrallen
Copy link
Contributor

The injector creation workflow usually goes through cusotom Druid Guice handlings rather than making a Guice injector using Guice directly.
io.druid.initialization.Initialization.makeInjectorWithModules for example.

These are setup during the CLI launching workflow.

Did this come about during actually running a service? (the CLI command workflow should have injected stuff properly) or during a unit test?

Guice injection in a unit test is a PITA right now.

xvrl added a commit that referenced this pull request Mar 26, 2015
Bug fix @DruidSecondaryModule plus unit test
@xvrl xvrl merged commit 389ea4c into apache:master Mar 26, 2015
@b-slim
Copy link
Contributor Author

b-slim commented Mar 26, 2015

@drcrallen It is come when running any service. The reason i used the class name emitter because it did happen when i did used my own custom emitter module.

@cheddar
Copy link
Contributor

cheddar commented Mar 26, 2015

@drcrallen If you look at how Guice is setup, the unit test is replicating exactly how Guice works inside of Druid. This is a real problem in the current code as evidenced by the unit test that now passes.

@drcrallen
Copy link
Contributor

@cheddar Unless you're actually calling the methods in io.druid.cli.Main you cannot say you are replicating exactly what happens with initial Guice injection. You can say that you are close, or that you capture the intended workflow, but you are not using the same workflow.

I don't fully understand why "make objectMapper eager to ensure jackson gets setup with guice injection for JsonConfigurator" is no longer a relevant concern. But the PR is in so there's not much use in dwelling on it.

@xvrl
Copy link
Member

xvrl commented Mar 26, 2015

@drcrallen I trust @cheddar on this one, since he initially wrote the Guice injection bootstrapping and it hasn't changed much since. I assume this has been tested standalone and we'll have to make sure it doesn't break any of the examples or extensions being able to register jackson types.

@b-slim @cheddar since you are working on making things more pluggable, it would be really cool if you could write some documentation on pluggable things, e.g. showing how you can build your own emitter module. Maybe we can add a section for that to the documentation revamp.

@b-slim
Copy link
Contributor Author

b-slim commented Mar 26, 2015

@xvrl That sounds a good idea, will try to write some doc about it.

@fjy
Copy link
Contributor

fjy commented Mar 26, 2015

@b-slim Just an FYI, if you've been following the Druid proposals, I am currently making gigantic changes to docs right now. It may be a good idea to wait until my changes are in before making any doc changes on your side.

@b-slim b-slim deleted the fix_injector_plus_ut branch July 30, 2015 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants