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

Parsing fails when using a character sequence #185

Closed
Azenet opened this Issue May 22, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@Azenet

Azenet commented May 22, 2017

Problem description

Parsing fails when using a sequence that matches \\[^0-7'"]\+\$ (example: \s+$), parse endpoint does a 500 error and the following exception is thrown:

2017-05-22 15:29:47,095 ERROR: org.graylog2.shared.rest.exceptionmappers.AnyExceptionClassMapper - Unhandled exception in REST resource
java.lang.NullPointerException: null
        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser$RuleTypeAnnotator.exitMultiplication(PipelineRuleParser.java:718) ~[?:?]
        at org.graylog.plugins.pipelineprocessor.parser.RuleLangParser$MultiplicationContext.exitRule(RuleLangParser.java:642) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.exitRule(ParseTreeWalker.java:71) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:54) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]
        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]
        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:171) ~[?:?]
        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:135) ~[?:?]
        at org.graylog.plugins.pipelineprocessor.rest.RuleResource.parse(RuleResource.java:119) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_72-internal]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_72-internal]
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]
        at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]
        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_72-internal]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_72-internal]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72-internal]

Steps to reproduce the problem

  1. Create new pipeline rule
  2. Paste this:
rule "example"
when
  true
then
  let a = "\s+$"
end

Environment

  • Graylog Version: 2.3.0-alpha.2+f24e575
  • Pipeline Processor plugin version: 2.3.0-alpha.2
  • Elasticsearch Version: 5.4.0
  • MongoDB Version: 3.4.4
  • Operating System: Linux/Docker
  • Browser version: Chrome 58
@joschi

This comment has been minimized.

Contributor

joschi commented May 22, 2017

@Azenet The backslash character has to be escaped, i. e. "\\s" instead of "\s".

This being said, forgetting to escape the backslash character should not trigger a NullPointerException.

@bernd

This comment has been minimized.

Member

bernd commented Jun 19, 2017

@Azenet Does escaping the backslash character help?

@Azenet

This comment has been minimized.

Azenet commented Jun 19, 2017

@bernd yes, once it is escaped it works properly.

joschi added a commit that referenced this issue Jul 5, 2017

@wafflebot wafflebot bot added the in progress label Jul 5, 2017

@joschi joschi added enhancement and removed needs-input labels Jul 5, 2017

@joschi joschi added this to the 2.3.0 milestone Jul 5, 2017

@bernd bernd closed this in #196 Jul 5, 2017

bernd added a commit that referenced this issue Jul 5, 2017

@wafflebot wafflebot bot removed the in progress label Jul 5, 2017

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