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

elasticsearch_max_time_per_index configuratoin leads to ArithmeticException division by zero #836

Closed
ghost opened this Issue Dec 29, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@ghost

ghost commented Dec 29, 2014

I'm using the latest graylog2 v0.93-3 version with elasticinbox 1.4.x . i've added the following parameter in the graylog2.conf :

elasticsearch_max_time_per_index = 30d

to keep the index 30d persisted. After restarting the graylog2-server service, I'm seeing the following message in the server.log

2014-12-29T13:59:22.157+01:00 ERROR [IndexRotationThread] Couldn't point deflector to a new index
com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, java.lang.ArithmeticException: / by zero
  at org.graylog2.indexer.rotation.TimeBasedRotationStrategy.<init>(TimeBasedRotationStrategy.java:43)
  at org.graylog2.indexer.rotation.TimeBasedRotationStrategy.class(TimeBasedRotationStrategy.java:34)
  while locating org.graylog2.indexer.rotation.TimeBasedRotationStrategy
  while locating org.graylog2.plugin.indexer.rotation.RotationStrategy annotated with @com.google.inject.multibindings.Element(setName=,uniqueId=112)
  at org.graylog2.bindings.RotationStrategyBindings.configure(RotationStrategyBindings.java:29)
  while locating java.util.Map<java.lang.String, org.graylog2.plugin.indexer.rotation.RotationStrategy>
    for parameter 0 at org.graylog2.bindings.providers.RotationStrategyProvider.<init>(RotationStrategyProvider.java:32)
  while locating org.graylog2.bindings.providers.RotationStrategyProvider
  while locating org.graylog2.plugin.indexer.rotation.RotationStrategy

1 error
        at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
        at org.graylog2.periodical.IndexRotationThread.checkForRotation(IndexRotationThread.java:79)
        at org.graylog2.periodical.IndexRotationThread.doRun(IndexRotationThread.java:66)
        at org.graylog2.plugin.periodical.Periodical.run(Periodical.java:83)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArithmeticException: / by zero
        at org.graylog2.indexer.rotation.TimeBasedRotationStrategy.determineRotationPeriodAnchor(TimeBasedRotationStrategy.java:100)
        at org.graylog2.indexer.rotation.TimeBasedRotationStrategy.<init>(TimeBasedRotationStrategy.java:48)
        at org.graylog2.indexer.rotation.TimeBasedRotationStrategy.<init>(TimeBasedRotationStrategy.java:43)
        at org.graylog2.indexer.rotation.TimeBasedRotationStrategy$$FastClassByGuice$$de058489.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
        at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
        at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
        at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:89)
        at com.google.inject.multibindings.MapBinder$RealMapBinder$2.get(MapBinder.java:387)
        at com.google.inject.multibindings.MapBinder$RealMapBinder$2.get(MapBinder.java:383)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
        at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
        at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:53)
        at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
        at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
        ... 10 more

changing the parameter to 31d, 720h, 721h and even 24h results in the same error.

Configuring the parameter with 5h, like:

elasticsearch_max_time_per_index = 5h

and restarting graylog2-server, it works well.

I'm running on an ubuntu 12.04 LTS

@kroepke kroepke added this to the 0.93 milestone Dec 29, 2014

@kroepke kroepke closed this in 570d22d Jan 2, 2015

kroepke added a commit that referenced this issue Jan 14, 2015

avoid division by zero when finding rotation anchor
the determined anchor is still not ideal for non-scalar periods (i.e. period which mix field types like 30d == 4w 2d), but it doesn't crash anymore

fixes #836
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment