ppalaga edited a comment on issue #69: FastCamelContext.clearModel() causes 
NPEs at runtime
URL: https://github.com/apache/camel-quarkus/issues/69#issuecomment-523965853
 
 
   Getting back to this one now. So clearing the model causes two known issues: 
(1) a NPE when calling `FastCamelRuntime.dumpRoutes()` and (2) a NPE in 
`ErrorHandlerReifier.lookupErrorHandlerFactory(RouteContext, String, boolean)`
   
   (1) is, I think, quite harmless. We can either ignore it or find a way how 
to describe a route without having the RouteDef available, perhaps by storing 
the description at build time somewhere, e.g. in `FastModel.FastRouteContext`
   
   (2) is I believe harder to solve. Here is the stack trace from the bean 
itest after `clearModel()` was re-activated in 
`FastCamelRuntime.loadRoutes(CamelContext)` (see 
https://github.com/ppalaga/camel-quarkus/tree/i69 ):
   
   ```
   19-08-22 14:22:25,519 ERROR [org.apa.cam.pro.err.DefaultErrorHandler] 
(executor-thread-1) Failed delivery for (MessageId: 
13A71AB740722A0-0000000000000001 on ExchangeId: 
13A71AB740722A0-0000000000000000). Exhausted after delivery attempt: 1 caught: 
org.apache.camel.RuntimeCamelException: java.lang.NullPointerException: 
org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
           at 
org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:52)
           at 
org.apache.camel.processor.MulticastProcessor.createErrorHandler(MulticastProcessor.java:721)
           at 
org.apache.camel.processor.MulticastProcessor.createProcessorExchangePair(MulticastProcessor.java:664)
           at 
org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:205)
           at 
org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:158)
           at 
org.apache.camel.processor.Splitter.createProcessorExchangePairsList(Splitter.java:230)
           at 
org.apache.camel.processor.Splitter.createProcessorExchangePairs(Splitter.java:124)
           at 
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:211)
           at org.apache.camel.processor.Splitter.process(Splitter.java:111)
           at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryState.run(RedeliveryErrorHandler.java:480)
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:185)
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
           at org.apache.camel.processor.Pipeline.process(Pipeline.java:87)
           at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:222)
           at 
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:72)
           at 
org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:189)
           at 
org.apache.camel.processor.SharedCamelInternalProcessor$1.process(SharedCamelInternalProcessor.java:90)
           at 
org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:77)
           at 
org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:87)
           at 
org.apache.camel.impl.engine.DefaultProducerCache.send(DefaultProducerCache.java:141)
           at 
org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:163)
           at 
org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:159)
           at 
org.apache.camel.impl.engine.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:347)
           at 
org.apache.camel.quarkus.component.bean.CamelResource.processOrder(CamelResource.java:41)
           at 
org.apache.camel.quarkus.component.bean.CamelResource_ClientProxy.processOrder(CamelResource_ClientProxy.zig:39)
           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 
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:151)
           at 
org.jboss.resteasy.core.MethodInjectorImpl.lambda$invoke$3(MethodInjectorImpl.java:122)
           at 
java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
           at 
java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:614)
           at 
java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:1983)
           at 
java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:110)
           at 
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:122)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:594)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:468)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:421)
           at 
org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:363)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:423)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:391)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invoke$1(ResourceMethodInvoker.java:365)
           at 
java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981)
           at 
java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2124)
           at 
java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:110)
           at 
org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:365)
           at 
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:477)
           at 
org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:252)
           at 
org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:153)
           at 
org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:363)
           at 
org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:156)
           at 
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:238)
           at 
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:249)
           at 
io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:30)
           at 
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
           at 
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
           at 
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
           at 
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
           at 
io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
           at 
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
           at 
io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
           at 
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
           at 
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
           at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
           at 
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
           at 
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
           at 
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
           at 
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
           at 
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
           at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
           at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
           at 
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
           at 
io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
           at 
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
           at 
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
           at 
io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
           at 
io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
           at 
io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1$1.call(UndertowDeploymentRecorder.java:513)
           at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
           at 
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
           at 
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
           at 
io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
           at 
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
           at 
org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
           at 
org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
           at 
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
           at 
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1395)
           at 
org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
           at 
org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
           at java.lang.Thread.run(Thread.java:748)
           at org.jboss.threads.JBossThread.run(JBossThread.java:479)
   Caused by: java.lang.NullPointerException
           at 
org.apache.camel.reifier.errorhandler.ErrorHandlerReifier.lookupErrorHandlerFactory(ErrorHandlerReifier.java:172)
           at 
org.apache.camel.reifier.errorhandler.ErrorHandlerReifier.lookupErrorHandlerFactory(ErrorHandlerReifier.java:152)
           at 
org.apache.camel.builder.ErrorHandlerBuilderRef.lookupErrorHandler(ErrorHandlerBuilderRef.java:70)
           at 
org.apache.camel.builder.ErrorHandlerBuilderRef.createErrorHandler(ErrorHandlerBuilderRef.java:42)
           at 
org.apache.camel.processor.MulticastProcessor.createErrorHandler(MulticastProcessor.java:704)
           ... 90 more
   ```
   
   The question is whether the `ErrorHandlerReifier` code should (a) really be 
triggered by a request or (b) if it should have been done during 
`FastCamelRuntime.loadRoutes(CamelContext)` before `clearModel()` is called? 
WDYT @gnodet @davsclaus @lburgazzoli ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to