Skip to content

Thread blocked - getConnection #69

Open
@leosilvadev

Description

@leosilvadev

Hi guys,

I faced this issue when trying to access a database, but my internet is really slow so it is taking some seconds to successfully establish a new connection, the problem is that it is blocking the main-thread.

Checking the error and the code I found something and would like to understand better:
AsyncConnectionPool.java (line 63)

connection
          .connect().onComplete(ScalaUtils.toFunction1(handler), VertxEventLoopExecutionContext.create(vertx));

Looks like this is using the current context to wait for the connection, right?

The stacktrace:

io.vertx.core.VertxException: Thread blocked
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
	at java.net.InetAddress.getAllByName(InetAddress.java:1192)
	at java.net.InetAddress.getAllByName(InetAddress.java:1126)
	at java.net.InetAddress.getByName(InetAddress.java:1076)
	at java.net.InetSocketAddress.<init>(InetSocketAddress.java:220)
	at com.github.mauricio.async.db.mysql.codec.MySQLConnectionHandler.connect(MySQLConnectionHandler.scala:87)
	at com.github.mauricio.async.db.mysql.MySQLConnection.connect(MySQLConnection.scala:84)
	at io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool.createConnection(AsyncConnectionPool.java:63)
	at io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool.createOrWaitForAvailableConnection(AsyncConnectionPool.java:77)
	at io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool.take(AsyncConnectionPool.java:86)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions