Katty Zambrano
Katty Zambrano

Reputation: 97

Blocked vertx threads

I must learn to develop microservices using:

And as an IDE I am using Intellij

The code I'm working on is this:

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.mongo.MongoClient;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.BodyHandler;

public class MainVerticle extends AbstractVerticle {

    MongoClient mongoSharedClient = null;

    private Future<Void> prepareDatabase(){

        Promise<Void> promises = Promise.promise();

        JsonObject config = Vertx.currentContext().config();

        String uri = config.getString("mongo_uri");

        if(uri == null){
            uri = "mongodb://localhost:27017";

        }

        String database = config.getString("mongo_db");
        if (database == null){
            database = "test";
        }

        JsonObject configMongo = new JsonObject();

        configMongo.put("connection_string", uri);
        configMongo.put("db_name", database);

        mongoSharedClient = MongoClient.create(vertx, configMongo);

        if(mongoSharedClient != null){
            promises.complete();
        }else {
            promises.fail("Error in Database");
        }

        return promises.future();
    }

    @Override
    public void start(Promise<Void> startFuture) throws Exception {

        prepareDatabase().compose(as-> HttpServer()).onComplete(asyn->{
            if(asyn.succeeded()){
                startFuture.complete();
            }else {
                startFuture.fail("Error");
            }
        });
    }

    private Future<Void> HttpServer(){
        Promise<Void> promises = Promise.promise();

        HttpServer server = vertx.createHttpServer();
        Router router = Router.router(vertx);

        router.get("/test/").handler(this::pruebaRuta);
        router.post("/create/").handler(this::createPrueba);
        router.post().handler(BodyHandler.create());

        server.requestHandler(router).listen(9090, ar -> {
            if(ar.succeeded()){
                promises.complete();
            }else {
                promises.fail(ar.cause());
            }
        });
        return promises.future();
    }

    private void createPrueba(RoutingContext routingContext) {
        JsonObject data = routingContext.getBodyAsJson();
        mongoSharedClient.insert("User", data, result -> {
            if(result.succeeded()){
                routingContext.response().setStatusCode(200).putHeader("Content-Type", "text/html").end("Operation Successful");
            }else {
                routingContext.response().setStatusCode(400).putHeader("Content-Type", "text/html").end(result.cause().getMessage());
            }
        });
        routingContext.response().setStatusCode(200).putHeader("Content-Type", "Application/Json; charset=utf-8").end(Json.encodePrettily(data));
    }

    private void pruebaRuta(RoutingContext routingContext) {

        routingContext.response().setStatusCode(200).putHeader("Content-Type", "text/html").end("Success Execute!");

    }

}

At the moment I only want to do small tests with postman, the problem is that when I run the project I get the following:

Connected to the target VM, address: '127.0.0.1:51951', transport: 'socket'
18:36:02.095 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
18:36:02.108 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
18:36:02.108 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
18:36:02.393 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
18:36:02.393 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
18:36:02.578 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
18:36:02.824 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
18:36:02.824 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
18:36:02.874 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows
18:36:02.878 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
18:36:02.880 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 8
18:36:02.883 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
18:36:02.886 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
18:36:02.888 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
18:36:02.889 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: available
18:36:02.892 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
18:36:02.892 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
18:36:02.892 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
18:36:02.892 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
18:36:02.894 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\kathy\AppData\Local\Temp (java.io.tmpdir)
18:36:02.894 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
18:36:02.899 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 934281216 bytes
18:36:02.899 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
18:36:02.902 [main] DEBUG io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available
18:36:02.902 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
18:36:02.924 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
18:36:06.345 [main] DEBUG io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider - Default DNS servers: [/1.1.1.1:53, /8.8.8.8:53] (sun.net.dns.ResolverConfiguration)
18:36:08.487 [vert.x-eventloop-thread-0] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
18:36:08.619 [vert.x-eventloop-thread-0] DEBUG org.mongodb.driver.cluster - Updating cluster description to  {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING}]
jul 07, 2020 6:36:09 PM io.vertx.core.impl.BlockedThreadChecker
ADVERTENCIA: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 2459 ms, time limit is 2000 ms
18:36:10.012 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
18:36:10.013 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
18:36:10.014 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
18:36:10.014 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
18:36:10.014 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
18:36:10.014 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
18:36:10.327 [vert.x-eventloop-thread-0] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
18:36:10.328 [vert.x-eventloop-thread-0] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
jul 07, 2020 6:36:10 PM io.vertx.core.impl.BlockedThreadChecker
ADVERTENCIA: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 3485 ms, time limit is 2000 ms
18:36:11.188 [vert.x-eventloop-thread-0] DEBUG io.netty.util.NetUtil - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
18:36:11.189 [vert.x-eventloop-thread-0] DEBUG io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
jul 07, 2020 6:36:11 PM io.vertx.core.impl.BlockedThreadChecker
ADVERTENCIA: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 4489 ms, time limit is 2000 ms
18:36:12.550 [vert.x-eventloop-thread-0] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 6252 (auto-detected)
jul 07, 2020 6:36:12 PM io.vertx.core.impl.BlockedThreadChecker
ADVERTENCIA: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 5489 ms, time limit is 2000 ms
io.vertx.core.VertxException: Thread blocked
    at java.net.NetworkInterface.getAll(Native Method)
    at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
    at io.netty.util.internal.MacAddressUtil.bestAvailableMac(MacAddressUtil.java:55)
    at io.netty.util.internal.MacAddressUtil.defaultMachineId(MacAddressUtil.java:138)
    at io.netty.channel.DefaultChannelId.<clinit>(DefaultChannelId.java:99)
    at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:101)
    at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:73)
    at io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:80)
    at io.netty.channel.nio.AbstractNioMessageChannel.<init>(AbstractNioMessageChannel.java:42)
    at io.netty.channel.socket.nio.NioDatagramChannel.<init>(NioDatagramChannel.java:150)
    at io.netty.channel.socket.nio.NioDatagramChannel.<init>(NioDatagramChannel.java:118)
    at io.vertx.core.net.impl.transport.Transport.datagramChannel(Transport.java:162)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1.lambda$newResolver$0(DnsResolverProvider.java:136)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1$$Lambda$43/1292567456.newChannel(Unknown Source)
    at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:310)
    at io.netty.bootstrap.AbstractBootstrap.register(AbstractBootstrap.java:227)
    at io.netty.resolver.dns.DnsNameResolver.<init>(DnsNameResolver.java:451)
    at io.netty.resolver.dns.DnsNameResolverBuilder.build(DnsNameResolverBuilder.java:473)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1$1.newNameResolver(DnsResolverProvider.java:186)
    at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:91)
    at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:76)
    at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:70)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1.newResolver(DnsResolverProvider.java:190)
    at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:70)
    at io.vertx.core.impl.AddressResolver.resolveHostname(AddressResolver.java:82)
    at io.vertx.core.impl.VertxImpl.resolveAddress(VertxImpl.java:810)
    at io.vertx.core.net.impl.AsyncResolveConnectHelper.doBind(AsyncResolveConnectHelper.java:56)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:253)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:188)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:184)
    at com.lakatuna.com.MainVerticle.HttpServer(MainVerticle.java:75)
    at com.lakatuna.com.MainVerticle.lambda$start$0(MainVerticle.java:56)
    at com.lakatuna.com.MainVerticle$$Lambda$30/752448968.apply(Unknown Source)
    at io.vertx.core.Future.lambda$compose$3(Future.java:363)
    at io.vertx.core.Future$$Lambda$32/767632927.handle(Unknown Source)
    at io.vertx.core.impl.FutureImpl.dispatch(FutureImpl.java:105)
    at io.vertx.core.impl.FutureImpl.onComplete(FutureImpl.java:83)
    at io.vertx.core.Future.compose(Future.java:359)
    at io.vertx.core.Future.compose(Future.java:331)
    at com.lakatuna.com.MainVerticle.start(MainVerticle.java:56)
    at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$9(DeploymentManager.java:556)
    at io.vertx.core.impl.DeploymentManager$$Lambda$9/726379593.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)
    at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
    at io.vertx.core.impl.EventLoopContext$$Lambda$10/1212772528.run(Unknown Source)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
    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)

18:36:13.149 [vert.x-eventloop-thread-0] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 9c:ad:97:ff:fe:8b:00:df (auto-detected)
18:36:13.342 [cluster-ClusterId{value='5f0506e849515074214c3f60', description='null'}-localhost:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:1}
18:36:13.602 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
18:36:13.602 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
18:36:13.602 [vert.x-eventloop-thread-0] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
18:36:13.635 [cluster-ClusterId{value='5f0506e849515074214c3f60', description='null'}-localhost:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:117)
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:128)
    at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157)
    at sun.nio.ch.Invoker.invoke(Invoker.java:185)
    at sun.nio.ch.Invoker.invoke(Invoker.java:297)
    at sun.nio.ch.WindowsAsynchronousSocketChannelImpl$ConnectTask.failed(WindowsAsynchronousSocketChannelImpl.java:302)
    at sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:399)
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: El equipo remoto rechazó la conexión de red.

    at sun.nio.ch.Iocp.translateErrorToIOException(Iocp.java:309)
    at sun.nio.ch.Iocp.access$700(Iocp.java:46)
    ... 5 common frames omitted
jul 07, 2020 6:36:13 PM io.vertx.core.impl.BlockedThreadChecker
ADVERTENCIA: Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 6490 ms, time limit is 2000 ms
io.vertx.core.VertxException: Thread blocked
    at java.net.DatagramSocket$1.run(DatagramSocket.java:312)
    at java.net.DatagramSocket$1.run(DatagramSocket.java:309)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.DatagramSocket.checkOldImpl(DatagramSocket.java:308)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:211)
    at sun.nio.ch.DatagramSocketAdaptor.<init>(DatagramSocketAdaptor.java:57)
    at sun.nio.ch.DatagramSocketAdaptor.create(DatagramSocketAdaptor.java:63)
    at sun.nio.ch.DatagramChannelImpl.socket(DatagramChannelImpl.java:173)
    at io.netty.channel.socket.nio.NioDatagramChannelConfig.<init>(NioDatagramChannelConfig.java:117)
    at io.netty.channel.socket.nio.NioDatagramChannel.<init>(NioDatagramChannel.java:151)
    at io.netty.channel.socket.nio.NioDatagramChannel.<init>(NioDatagramChannel.java:118)
    at io.vertx.core.net.impl.transport.Transport.datagramChannel(Transport.java:162)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1.lambda$newResolver$0(DnsResolverProvider.java:136)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1$$Lambda$43/1292567456.newChannel(Unknown Source)
    at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:310)
    at io.netty.bootstrap.AbstractBootstrap.register(AbstractBootstrap.java:227)
    at io.netty.resolver.dns.DnsNameResolver.<init>(DnsNameResolver.java:451)
    at io.netty.resolver.dns.DnsNameResolverBuilder.build(DnsNameResolverBuilder.java:473)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1$1.newNameResolver(DnsResolverProvider.java:186)
    at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:91)
    at io.netty.resolver.dns.DnsAddressResolverGroup.newResolver(DnsAddressResolverGroup.java:76)
    at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:70)
    at io.vertx.core.impl.resolver.DnsResolverProvider$1.newResolver(DnsResolverProvider.java:190)
    at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:70)
    at io.vertx.core.impl.AddressResolver.resolveHostname(AddressResolver.java:82)
    at io.vertx.core.impl.VertxImpl.resolveAddress(VertxImpl.java:810)
    at io.vertx.core.net.impl.AsyncResolveConnectHelper.doBind(AsyncResolveConnectHelper.java:56)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:253)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:188)
    at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:184)
    at com.lakatuna.com.MainVerticle.HttpServer(MainVerticle.java:75)
    at com.lakatuna.com.MainVerticle.lambda$start$0(MainVerticle.java:56)
    at com.lakatuna.com.MainVerticle$$Lambda$30/752448968.apply(Unknown Source)
    at io.vertx.core.Future.lambda$compose$3(Future.java:363)
    at io.vertx.core.Future$$Lambda$32/767632927.handle(Unknown Source)
    at io.vertx.core.impl.FutureImpl.dispatch(FutureImpl.java:105)
    at io.vertx.core.impl.FutureImpl.onComplete(FutureImpl.java:83)
    at io.vertx.core.Future.compose(Future.java:359)
    at io.vertx.core.Future.compose(Future.java:331)
    at com.lakatuna.com.MainVerticle.start(MainVerticle.java:56)
    at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$9(DeploymentManager.java:556)
    at io.vertx.core.impl.DeploymentManager$$Lambda$9/726379593.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)
    at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
    at io.vertx.core.impl.EventLoopContext$$Lambda$10/1212772528.run(Unknown Source)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
    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)

18:36:13.660 [cluster-ClusterId{value='5f0506e849515074214c3f60', description='null'}-localhost:27017] DEBUG org.mongodb.driver.cluster - Updating cluster description to  {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.io.IOException: El equipo remoto rechazó la conexión de red.
}}]

Vertx threads are blocked.

In postman I try to test the route localhost:9090/create/

In postman I try to test the route localhost:9090/create/ and it returns error 500

I know the question is long, but seriously I don't know what to do, I have looked for a solution but the truth is that I don't really understand what my mistake is or what is happening, I need your help. Thank you very much

Upvotes: 1

Views: 6953

Answers (1)

ThisIsNoZaku
ThisIsNoZaku

Reputation: 2443

If you look at the middle stacktrace, it is reporting that the host it's trying to reach to connect to the Mongo database rejected the connection. Make sure it is reachable.

I'll bet the 500 error you're seeing is a Null Pointer Exception caused by you trying to use the mongo client even though it failed to initialize and the variable was never assigned.

The first and third stacktrace are complaining that binding to the ports while starting up the server is taking too long. This might be an issue in the underlying netty library.

Upvotes: 1

Related Questions