0 0

sqlalchemy 支持多库问题.5

各位师兄,师姐:
     您们辛苦了!
     我有个问题,贴出来.看大家遇到过吗?怎么解决的.
     我在用sqlalchemy 多库支持时. 在多台app上总是报错 .mysql连接断了.失败.
     我没用session 我在createEngine;后  然后在 engine.execute(sql)就在这层报错了.具体日志我贴出来,大家帮忙看看.
#####################################################################开始a页面
getVideoById
111111111111= select * from video where id=12514 limit 0,1
before engine
2009-04-16 11:01:25,039 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> checked out from pool
after engine
2009-04-16 11:01:25,040 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> being returned to pool
2009-04-16 11:01:25,043 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> checked out from pool
2009-04-16 11:01:25,044 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> being returned to pool
[16/Apr/2009 11:01:25] "GET /playvideo/playvideo/12514/ HTTP/1.1" 200 7033
[16/Apr/2009 11:01:26] "POST /playvideo/getcomment/ HTTP/1.1" 200 2
2009-04-16 11:01:33,068 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> checked out from pool
2009-04-16 11:01:33,070 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> being returned to pool
[16/Apr/2009 11:01:33] "POST /playvideo/getcomment/ HTTP/1.1" 200 2
2009-04-16 11:01:37,687 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> checked out from pool
2009-04-16 11:01:37,690 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> being returned to pool
[16/Apr/2009 11:01:37] "POST /playvideo/getcomment/ HTTP/1.1" 200 2
[16/Apr/2009 11:01:42] "POST /playvideo/getcomment/ HTTP/1.1" 200 2

#####################################################################a页面执行完

####################################################################开始b页面

getVideoById
111111111111= select * from video where id=12516 limit 0,1
before engine
2009-04-16 11:01:50,453 INFO sqlalchemy.pool.QueuePool.0x..50 Connection <_mysql.connection open to '172.16.101.237' at 2e7a460> checked out from pool
2009-04-16 11:01:50,453 INFO sqlalchemy.pool.QueuePool.0x..50 Invalidate connection <_mysql.connection open to '172.16.101.237' at 2e7a460> (reason: OperationalError:(2006, 'MySQL server has gone away'))
2009-04-16 11:01:50,454 INFO sqlalchemy.pool.QueuePool.0x..50 Closing connection <_mysql.connection open to '172.16.101.237' at 2e7a460>
2009-04-16 11:01:50,454 INFO sqlalchemy.pool.QueuePool.0x..50 Connection None being returned to pool
2009-04-16 11:01:50,454 INFO sqlalchemy.pool.QueuePool.0x..50 Pool disposed. Pool size: 20  Connections in pool: 0 Current Overflow: -20 Current Checked out connections: 0
2009-04-16 11:01:50,454 INFO sqlalchemy.pool.QueuePool.0x..50 Pool recreating
excute error
(OperationalError) (2006, 'MySQL server has gone away') 'select * from video where id=12516 limit 0,1' {}
--------------------
False


在 28行时 发现 Invalidate connection,是被mysqlserver断掉的。然后Closing connection,然后Pool disposed,然后Pool recreating,然后b页面就出错了。
2009年4月16日 21:00

1个答案 按时间排序 按投票排序

0 0

连接池中的连接数量不够了吧!!

2009年4月21日 17:00

相关推荐

Global site tag (gtag.js) - Google Analytics