| Summary: | [DB][Mysql] Exception when CDO is idle for a while | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Egidijus Vaisnora <vaisegid> | ||||||||||
| Component: | cdo.core | Assignee: | Caspar D. <caspar_d> | ||||||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P2 | CC: | caspar_d, saulius.tvarijonas, stefan | ||||||||||
| Version: | 4.0 | Flags: | stepper:
review+
|
||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Egidijus Vaisnora
Can you specify what "a while" is, roughly? MySQL disvonnects a client after an idle time of 8 hours (default value, please check your MySQL server for your setting). To prevent the disconnection, there is a timer facility in CDO which should prevent this by issuing a query every 4 hours (again, this is a default value that can be configured). That said, there has been some work in the past year (I think Eike did it) to reduce the amount of single timers on the server. Maybe something got optimized away too much ;-) I left it for a night... However I was able to use server after I discovered stack trace, hence I cannot say that it spoil server. On another hand, maybe server was responding by taking values from the cache, without connecting to DB, I cannot tell this exactly. (In reply to comment #1) > To prevent the disconnection, there is a timer facility in CDO which should > prevent this by issuing a query every 4 hours Er, yes. As can be seen from the stack trace, it is this keepalive statement itself that fails. Logical (but not the only possible) conclusion: the MySQL instance that caused this 'incident', disconnected the client before the keepAlive task got executed, and that means earlier than 4 hours. > (again, this is a default value that can be configured). How is that? At DBStoreAccessor.java:750, the task gets scheduled with hardcoded values... I propose we do two things: 1. Make the keepAlive period really configurable 2. If the keepAlive statement fails, try to open a new connection. Created attachment 191804 [details]
Patch
MySQL's JDBC driver offers a property 'autoReconnect' which can be set to 'true' to make the driver itself attempt to reconnect when it discovers that the connection is no longer alive. See: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Perhaps other drivers support something similar. Neverthless, the reconnect code that I've added to ConnectionKeepAliveTask, is still useful for JDBC drivers that do offer such support. As further info: in the case of MySQL, the disconnects can be avoided altogether by configuring the MySQL server's wait_timeout variable to some large value. As Stefan said, the default is 28800, i.e. 8 hours. Created attachment 191805 [details]
Patch v2
Created attachment 191810 [details]
Patch v3
Created attachment 192435 [details]
Patch v4
Renamed xyzPropertyValues() to xyzPersistentProperties()
Please also add a section below http://wiki.eclipse.org/CDO/Server_Configuration_Reference#Element_store Committed revisions 7580, 7581, 7582, 7583, 7584. Committed in chunks to work around inexplicable refusal of SVN client to commit in one go. Will commit from command line from now on. Wiki updated. Available in R20110608-1407 |