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

DEV UI NPE when channel not configured. #15293

Closed
kristijan-rusu opened this issue Feb 24, 2021 · 6 comments · Fixed by #15301
Closed

DEV UI NPE when channel not configured. #15293

kristijan-rusu opened this issue Feb 24, 2021 · 6 comments · Fixed by #15301
Assignees
Milestone

Comments

@kristijan-rusu
Copy link

kristijan-rusu commented Feb 24, 2021

Describe the bug
DEV UI throws NPE when you have @incoming annotated method without input.
Expected behavior
DEV UI messaging part should not expect that everything is always connected. Throughout development it can happen to have channels which are not connected to any input.

Actual behavior
Internal server error because of NPE.
publisher is null in DevChannelInfo class.

To Reproduce

/**
 * Process event.
 */
@Incoming("bogus-channel")
public void process(Event event) {
	System.out.println(event);
}

Steps to reproduce the behavior:

  1. Create incoming channel which is not configured with connector or in-memory emitter.
  2. Start the application in DEV mode.
  3. Open DEV UI

Environment (please complete the following information):
Environment information is not need here.

  • Output of uname -a or ver: Darwin Kernel Version 20.3.0
  • Output of java -version: Java version: 1.8.0_281, vendor: Oracle Corporation
  • GraalVM version (if different from Java): Not applicable.
  • Quarkus version or git rev: 1.12.0.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3

Additional context
Stack trace:

[io.qua.ver.htt.dep.dev.con.DevConsoleProcessor] (vert.x-eventloop-thread-1) Dev console request failed : java.lang.IllegalStateException: Reflection invocation error
	at io.quarkus.qute.ReflectionValueResolver.resolve(ReflectionValueResolver.java:58)
	at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:128)
	at io.quarkus.qute.EvaluatorImpl.resolveReference(EvaluatorImpl.java:79)
	at io.quarkus.qute.EvaluatorImpl.lambda$evaluate$0(EvaluatorImpl.java:41)
	at java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:995)
	at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2137)
	at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:110)
	at io.quarkus.qute.EvaluatorImpl.evaluate(EvaluatorImpl.java:39)
	at io.quarkus.qute.ResolutionContextImpl.evaluate(ResolutionContextImpl.java:31)
	at io.quarkus.qute.ExpressionNode.resolve(ExpressionNode.java:26)
	at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:134)
	at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:37)
	at io.quarkus.qute.Parser$1.resolve(Parser.java:1017)
	at io.quarkus.qute.SectionNode.resolve(SectionNode.java:34)
	at io.quarkus.qute.TemplateImpl$TemplateInstanceImpl.renderData(TemplateImpl.java:107)
	at io.quarkus.qute.TemplateImpl$TemplateInstanceImpl.renderAsync(TemplateImpl.java:90)
	at io.quarkus.qute.TemplateImpl$TemplateInstanceImpl.render(TemplateImpl.java:55)
	at io.quarkus.qute.Template.render(Template.java:109)
	at io.quarkus.vertx.http.deployment.devmode.console.DevConsole.sendMainPage(DevConsole.java:143)
	at io.quarkus.vertx.http.deployment.devmode.console.DevConsole.handle(DevConsole.java:76)
	at io.quarkus.vertx.http.deployment.devmode.console.DevConsole.handle(DevConsole.java:32)
	at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
	at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
	at io.vertx.ext.web.impl.RoutingContextWrapper.next(RoutingContextWrapper.java:176)
	at io.quarkus.vertx.http.deployment.devmode.console.FlashScopeHandler.handle(FlashScopeHandler.java:12)
	at io.quarkus.vertx.http.deployment.devmode.console.FlashScopeHandler.handle(FlashScopeHandler.java:7)
	at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
	at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
	at io.vertx.ext.web.impl.RoutingContextWrapper.next(RoutingContextWrapper.java:176)
	at io.vertx.ext.web.impl.RouterImpl.handleContext(RouterImpl.java:235)
	at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1038)
	at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:137)
	at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:132)
	at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:54)
	at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:36)
	at io.quarkus.vertx.http.deployment.devmode.console.DevConsoleProcessor$2$1.handle(DevConsoleProcessor.java:167)
	at io.quarkus.vertx.http.deployment.devmode.console.DevConsoleProcessor$2$1.handle(DevConsoleProcessor.java:164)
	at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:136)
	at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43)
	at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229)
	at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:163)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.quarkus.netty.runtime.virtual.VirtualChannel.readInbound(VirtualChannel.java:251)
	at io.quarkus.netty.runtime.virtual.VirtualChannel.doBeginRead(VirtualChannel.java:274)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.beginRead(AbstractChannel.java:843)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.read(DefaultChannelPipeline.java:1362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeRead(AbstractChannelHandlerContext.java:686)
	at io.netty.channel.AbstractChannelHandlerContext.read(AbstractChannelHandlerContext.java:671)
	at io.netty.channel.DefaultChannelPipeline.read(DefaultChannelPipeline.java:1004)
	at io.netty.channel.AbstractChannel.read(AbstractChannel.java:278)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.readIfIsAutoRead(DefaultChannelPipeline.java:1422)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelActive(DefaultChannelPipeline.java:1400)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:230)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:216)
	at io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:895)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:510)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
	at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.quarkus.qute.MethodWrapper.getValue(MethodWrapper.java:22)
	at io.quarkus.qute.ReflectionValueResolver.resolve(ReflectionValueResolver.java:56)
	... 71 more
Caused by: java.lang.NullPointerException
	at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.DevReactiveMessagingInfos$DevChannelInfo.compareTo(DevReactiveMessagingInfos.java:142)
	at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.DevReactiveMessagingInfos$DevChannelInfo.compareTo(DevReactiveMessagingInfos.java:115)
	at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:325)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
	at java.util.Arrays.sort(Arrays.java:1312)
	at java.util.Arrays.sort(Arrays.java:1506)
	at java.util.ArrayList.sort(ArrayList.java:1464)
	at java.util.Collections.sort(Collections.java:143)
	at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.DevReactiveMessagingInfos$1.get(DevReactiveMessagingInfos.java:97)
	at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.DevReactiveMessagingInfos$1.get(DevReactiveMessagingInfos.java:28)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.DevReactiveMessagingInfos.getChannels(DevReactiveMessagingInfos.java:112)
	... 77 more
@kristijan-rusu kristijan-rusu added the kind/bug Something isn't working label Feb 24, 2021
@gsmet
Copy link
Member

gsmet commented Feb 24, 2021

/cc @michalszynkiewicz @cescoffier

@michalszynkiewicz
Copy link
Member

cc @mkouba :)

@mkouba
Copy link
Contributor

mkouba commented Feb 24, 2021

Hm, I thought that an @Incoming method for which no matching channel exists must result in a deployment error. But that's obviously not the case. @cescoffier Is it intentional?

@mkouba mkouba self-assigned this Feb 24, 2021
@gsmet
Copy link
Member

gsmet commented Feb 24, 2021

Even if it was the case, I would try to be safe in the UI. Because if things change at some point, we won't notice it.

@cescoffier
Copy link
Member

@mkouba it should fail, yes, but only on recent Smallrye Reactive Messaging.

@mkouba
Copy link
Contributor

mkouba commented Feb 24, 2021

@mkouba it should fail, yes, but only on recent Smallrye Reactive Messaging.

I see. Anyway, the NPE should be fixed in the linked PR.

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

Successfully merging a pull request may close this issue.

5 participants