Netflix/mantis

Error registering query when trying Getting Started

aspcompiler opened this issue · 4 comments

Context

I tried to follow your Getting Started and run locally, when I curl from another terminal, I got the "Error registering query" error.

Steps to reproduce

I ran:

curl "localhost:8503?subscriptionId=nj&criterion=select%20country%20from%20stream%20where%20status%3D%3D500&clientId=nj2"

Here is the log:

2019-10-30 11:40:48 INFO TaggedEventFilter:74 - Created SourceEventFilter! for subId [nj2_nj] in Job : UNKNOWN with Id UNKNOWN
2019-10-30 11:40:48 INFO QueryRequestPreProcessor:49 - QueryRequestPreProcessor:queryParams: {subscriptionId=[nj], criterion=[select country from stream where status==500], clientId=[nj2]}
2019-10-30 11:40:48 INFO QueryRequestPreProcessor:60 - Registering query select country from stream where status==500
2019-10-30 11:40:48 INFO QueryRefCountMap:40 - adding query nj2_nj query select country from stream where status==500
2019-10-30 11:40:48 ERROR QueryRequestPreProcessor:68 - Error registering query
java.lang.ExceptionInInitializerError
at io.mantisrx.sourcejob.synthetic.core.MQLQueryManager.registerQuery(MQLQueryManager.java:41)
at io.mantisrx.sourcejob.synthetic.sink.QueryRefCountMap.addQuery(QueryRefCountMap.java:45)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.registerQuery(QueryRequestPreProcessor.java:77)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.call(QueryRequestPreProcessor.java:62)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.call(QueryRequestPreProcessor.java:41)
at io.reactivex.mantis.network.push.PushServerSse$1.handle(PushServerSse.java:254)
at mantis.io.reactivex.netty.protocol.http.server.HttpConnectionHandler$1$1.onNext(HttpConnectionHandler.java:104)
at mantis.io.reactivex.netty.protocol.http.server.HttpConnectionHandler$1$1.onNext(HttpConnectionHandler.java:62)
at rx.subjects.PublishSubject$PublishSubjectProducer.onNext(PublishSubject.java:304)
at rx.subjects.PublishSubject$PublishSubjectState.onNext(PublishSubject.java:219)
at rx.subjects.PublishSubject.onNext(PublishSubject.java:72)
at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
at rx.subjects.SerializedSubject.onNext(SerializedSubject.java:67)
at mantis.io.reactivex.netty.pipeline.ObservableAdapter.channelRead(ObservableAdapter.java:50)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at mantis.io.reactivex.netty.protocol.http.server.ServerRequestResponseConverter.channelRead(ServerRequestResponseConverter.java:115)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at mantis.io.reactivex.netty.metrics.BytesInspector.channelRead(BytesInspector.java:59)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:138)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'io.mantisrx.mql.shaded.clojure.com.netflix.mantis.examples.core/require
at io.mantisrx.mql.shaded.clojure.lang.Var$Unbound.throwArity(Var.java:43)
at io.mantisrx.mql.shaded.clojure.lang.AFn.invoke(AFn.java:32)
at io.mantisrx.mql.shaded.clojure.lang.Var.invoke(Var.java:379)
at io.mantisrx.sourcejob.synthetic.core.MQL.(MQL.java:54)
... 52 more

Expected behavior

Should return some matching events.

Actual Behavior

Throw exception. May be I need to use some meaningful subscriptionId and clientId?

If I repeat running the query, I got a better error message of "class not found" on io.mantisrx.sourcejob.synthetic.core.MQL:

2019-10-30 12:42:00 ERROR QueryRequestPreProcessor:68 - Error registering query
java.lang.NoClassDefFoundError: Could not initialize class io.mantisrx.sourcejob.synthetic.core.MQL
at io.mantisrx.sourcejob.synthetic.core.MQLQueryManager.registerQuery(MQLQueryManager.java:41)
at io.mantisrx.sourcejob.synthetic.sink.QueryRefCountMap.addQuery(QueryRefCountMap.java:45)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.registerQuery(QueryRequestPreProcessor.java:77)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.call(QueryRequestPreProcessor.java:62)
at io.mantisrx.sourcejob.synthetic.sink.QueryRequestPreProcessor.call(QueryRequestPreProcessor.java:41)
at io.reactivex.mantis.network.push.PushServerSse$1.handle(PushServerSse.java:254)
at mantis.io.reactivex.netty.protocol.http.server.HttpConnectionHandler$1$1.onNext(HttpConnectionHandler.java:104)
at mantis.io.reactivex.netty.protocol.http.server.HttpConnectionHandler$1$1.onNext(HttpConnectionHandler.java:62)
at rx.subjects.PublishSubject$PublishSubjectProducer.onNext(PublishSubject.java:304)
at rx.subjects.PublishSubject$PublishSubjectState.onNext(PublishSubject.java:219)
at rx.subjects.PublishSubject.onNext(PublishSubject.java:72)
at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91)
at rx.subjects.SerializedSubject.onNext(SerializedSubject.java:67)
at mantis.io.reactivex.netty.pipeline.ObservableAdapter.channelRead(ObservableAdapter.java:50)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at mantis.io.reactivex.netty.protocol.http.server.ServerRequestResponseConverter.channelRead(ServerRequestResponseConverter.java:115)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at mantis.io.reactivex.netty.metrics.BytesInspector.channelRead(BytesInspector.java:59)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:138)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:748)

Hey aspcompiler! Sorry for the delay in getting to this, I am able to reproduce your issue and will work on getting a fix out this morning.

A quick update @aspcompiler it looks as though a string replace botched the MQL wrapper. You should be good to go with the latest commit, feel free to play with the query a little bit, source jobs implement the projection and filtering semantics of MQL but rely on the client to do some of the more advanced functionality. We have an mql-lite job somewhere that does this, I'll see about getting it added to the repository this morning.

Thanks for trying us out, and sorry about this error!

Oh, and there is an mql-lite in the mantis-examples mql-lite branch. I'll get this merged early next week.