Skip to content

Thread blocked - getConnection #69

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

Open
leosilvadev opened this issue Mar 13, 2017 · 5 comments
Open

Thread blocked - getConnection #69

leosilvadev opened this issue Mar 13, 2017 · 5 comments

Comments

@leosilvadev
Copy link
Contributor

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)
@vietj
Copy link
Contributor

vietj commented Mar 13, 2017 via email

@leosilvadev
Copy link
Contributor Author

@vietj, would not be good just to use another execution service from our side? or run this in a executeBlocking just like we do with jdbc-async?

@vietj
Copy link
Contributor

vietj commented Mar 14, 2017

I believe it would be easier to use the io.vertx.core.impl.AddressResolver and then directly use the resolved InetSocketAddress

@leosilvadev
Copy link
Contributor Author

leosilvadev commented Mar 14, 2017

@vietj I can check this when have some time if needed, just need to understand better the integration

@xdpsee
Copy link

xdpsee commented Jun 20, 2019

https://thoeni.io/post/macos-sierra-java/

this solution!

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

No branches or pull requests

3 participants