1
votes

I have a vertx based java microservice running on a k8 cluster. When a new pod is installed, during the init I get this exception intermittently. Upgraded the vertx core and vertx web version from 3.5.3 to 3.9.3 but it didnt help. The app continues to be alive and fine after these exceptions. I wanted to know the root cause for this.

This is happening during init. Here is what I am doing during init

  1. deploy verticle A: vertx.deployVerticle(new Verticle_A(), serverOpts,this::deploymentHandler);

  2. deploy verticle B: vertx.deployVerticle(new Verticle_B(), serverOpts,this::deploymentHandler);

  3. In each verticle I am doing:

     httpServer = vertx.createHttpServer(serverOptions);
     httpServer.requestHandler(req -> {
         LOG.trace("Request hit the server " + req.absoluteURI());
     });
    
     httpServer.listen(Constants.PORT, (result) -> {
         if (result.succeeded()) {
             this.httpServer = result.result();
             LOG.info("Successfully started server on port: " + Constants.PORT);
         } else {
             LOG.error("Failed to start server: ", result.cause());
         }
     });
    

Both the verticles are deployed successfully and the Http servers are started

I am new to vertx and k8s so any help would be appreciated.

SEVERE: Unhandled exception 
java.util.NoSuchElementException: handler 
at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1073) 
at io.netty.channel.DefaultChannelPipeline.addBefore(DefaultChannelPipeline.java:248) 
at io.netty.channel.DefaultChannelPipeline.addBefore(DefaultChannelPipeline.java:237) 
at io.vertx.core.http.impl.HttpHandlers.initializeWebsocketExtensions(HttpHandlers.java:92) 
at io.vertx.core.http.impl.HttpHandlers.handle(HttpHandlers.java:69) 
at io.vertx.core.http.impl.HttpHandlers.handle(HttpHandlers.java:34) 
at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) 
at io.vertx.core.impl.WorkerContext.lambda$wrapTask$0(WorkerContext.java:35) 
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) 
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 
at java.base/java.lang.Thread.run(Thread.java:830) 

Oct 12, 2020 11:43:28 PM io.vertx.core.impl.ContextImpl 
SEVERE: Unhandled exception 
java.lang.NullPointerException 
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.WorkerContext.lambda$wrapTask$0(WorkerContext.java:35) 
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) 
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 
at java.base/java.lang.Thread.run(Thread.java:830)
1

1 Answers

0
votes

Please try to provide more details next time but it seems you don't have "handler" but you tried to use it. I think it might be also not initialized properly. But I can't really know since you didn't provide source code.