Skip to content
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

线上一直出现execute() is called on closed statement问题求助 #2098

Open
smileMrLee opened this issue Nov 7, 2017 · 3 comments
Open

Comments

@smileMrLee
Copy link

线上频繁出现error日志

image

已定位到是由于连接关闭造成

image

求助

  • 怎么预防这个问题,是配置用得不对吗?看起来问题是因为数据库连接池没有把已经关闭的连接回收掉,造成的。而且不重启应用的话,坏掉的连接一直不会被回收。
    druid版本:1.0.28
    mysql:阿里云rds mysql 5.6
    多谢了!
@wenshao
Copy link
Member

wenshao commented Nov 8, 2017

升级到druid-1.1.5版本试试看

@paomian
Copy link

paomian commented Nov 10, 2017

我觉得这个问题在 1.1.5 并没有修复,我同样的配置,在 1.1.5 上遇见了同样的错误。

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 79,381 milliseconds ago.  The last packet sent successfully to the server was 19,366 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3746)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2509)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)

和这个一样 #2046

@SummerSunC
Copy link

这个是druid老版本的bug ,druid使用了preparedStatementPool,当发生异常时而没有及时释放preparedStatement导致的,这个问题已经在1.0.29中修复了

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

No branches or pull requests

4 participants