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

MyCat 运行一段时间后报如下错误: close connection,reason:register err #1150

Closed
icloudsun opened this issue Oct 13, 2016 · 6 comments

Comments

@icloudsun
Copy link

icloudsun commented Oct 13, 2016

mycat 1.6

wrapper.log 记录如下:

INFO | jvm 1 | 2016/10/13 18:27:53 | 2016-10-13 18:27:53,726 [INFO ][$_NIOREACTOR-2-RW] close connection,reason:register errjava.lang.NullPointerException ,MySQLConnectio
n [id=55, lastTime=1476354473722, user=dbcoreprod1u2, schema=story_db_p01, old shema=story_db_p01, borrowed=false, fromSlaveDB=false, threadId=0, charset=utf8, txIsolation=3,
autocommit=true, attachment=null, respHandler=null, host=story-server-p01, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false](io.mycat.net.AbstractConnecti
on:AbstractConnection.java:508)

应用端报如下:

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException:

wait millis 30000, active 2
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122) ~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113) ~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73) ~[mybatis-3.3.0.jar:3.3.0]
at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) ~[mybatis-spring-1.2.2.jar:1.2.2]
... 53 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException:
wait millis 30000, active 2

查到对应的MyCat源代码:
io/mycat/net/NIOReactor.java 162

    private void register(Selector selector) {
        AbstractConnection c = null;
        if (registerQueue.isEmpty()) {
            return;
        }
        while ((c = registerQueue.poll()) != null) {
            try {
                ((NIOSocketWR) c.getSocketWR()).register(selector);
                c.register();
            } catch (Exception e) {
                c.close("register err" + e.toString());
            }
        }
    }

BTW:
其中这行
c.close("register err" + e.toString());
后面能加上一行:
LOGGER.error(selector, e);
吗?这样能看到具体是什么错误。

@magicdoom
Copy link
Contributor

你本地改下 然后看看具体是什么错误信息

2016-10-13 19:24 GMT+08:00 icloudsun notifications@github.com:

wrapper.log 记录如下:

INFO | jvm 1 | 2016/10/13 18:27:53 | 2016-10-13 18:27:53,726 [INFO
][$_NIOREACTOR-2-RW] close connection,reason:register errjava.lang.NullPointerException
,MySQLConnectio
n id=55, lastTime=1476354473722, user=dbcoreprod1u2, schema=story_db_p01,
old shema=story_db_p01, borrowed=false, fromSlaveDB=false, threadId=0,
charset=utf8, txIsolation=3,
autocommit=true, attachment=null, respHandler=null, host=story-server-p01,
port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false

应用端报如下:
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could
not get JDBC Connection; nested exception is com.alibaba.druid.pool.
GetConnectionTimeoutException:

wait millis 30000, active 2
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.
selectList(DefaultSqlSession.java:122) ~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.
selectList(DefaultSqlSession.java:113) ~[mybatis-3.3.0.jar:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.
selectOne(DefaultSqlSession.java:73) ~[mybatis-3.3.0.jar:3.3.0]
at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
~[mybatis-spring-1.2.2.jar:1.2.2]
... 53 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException:
Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.
GetConnectionTimeoutException:
wait millis 30000, active 2

查到对应的MyCat源代码:
io/mycat/net/NIOReactor.java 162

private void register(Selector selector) {
    AbstractConnection c = null;
    if (registerQueue.isEmpty()) {
        return;
    }
    while ((c = registerQueue.poll()) != null) {
        try {
            ((NIOSocketWR) c.getSocketWR()).register(selector);
            c.register();
        } catch (Exception e) {
            c.close("register err" + e.toString());
        }
    }
}

BTW:
其中这行
c.close("register err" + e.toString());
后面能加上一行:
LOGGER.error(selector, e);
吗?这样能看到具体是什么错误。


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1150, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAcmsZpT8pfvpPbNlh0TeKGe8uO3fTGFks5qzhTVgaJpZM4KVxh_
.

@icloudsun
Copy link
Author

@magicdoom 1.6 还更新吗?能否提交pr?

@magicdoom
Copy link
Contributor

欢迎提pr

2016-10-14 22:40 GMT+08:00 icloudsun notifications@github.com:

@magicdoom https://github.com/magicdoom 1.6 还更新吗?能否提交pr?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1150 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAcmsVxTBWK5suwEhnNuD6QQZJMsIGksks5qz5RWgaJpZM4KVxh_
.

@magicdoom
Copy link
Contributor

1.6已经加上了输出详细日志 请下载最新版本测试 然后反馈详细日志信息

@magicdoom
Copy link
Contributor

最新版1.6.5已fix

@mawenbin666
Copy link

最新版1.6.5已fix

好像没有解决,1.6.6.1的版本还有报这个错误

Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 401943, active 20, maxActive 20, creating 0, createErrorCount 2266

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

3 participants