mysql:problemresolution
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mysql:problemresolution [2013/07/25 09:13] – rlunaro | mysql:problemresolution [2013/10/04 10:10] (current) – removed rlunaro | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Problem Resolution ====== | ||
| - | |||
| - | ===== Problem ===== | ||
| - | |||
| - | < | ||
| - | 07/20 01:38:26 hibernate.util.JDBCExceptionReporter | ||
| - | |||
| - | The last packet successfully received from the server was 7.202.618 milliseconds ago. The last packet sent successfully to the server was 7.202.618 milliseconds ago. | ||
| - | |||
| - | </ | ||
| - | |||
| - | ===== Solution ===== | ||
| - | |||
| - | After several days investigating the problem I've found out that other database worked smoothly with the application, | ||
| - | |||
| - | I've copied several configuration values (max threads, log file size, cache size, etc..) from the " | ||
| - | |||
| - | The lesson: **too ambitious values (i.e. big caches, big memory comsumption, | ||
| - | |||
| - | |||
| - | ===== Some tools ===== | ||
| - | |||
| - | |||
| - | This will show you the current connections: | ||
| - | |||
| - | < | ||
| - | show status like ' | ||
| - | </ | ||
| - | |||
| - | Example of output: | ||
| - | |||
| - | < | ||
| - | mysql> show status like ' | ||
| - | +--------------------------+-------+ | ||
| - | | Variable_name | ||
| - | +--------------------------+-------+ | ||
| - | | Aborted_connects | ||
| - | | Connections | ||
| - | | Max_used_connections | ||
| - | | Ssl_client_connects | ||
| - | | Ssl_connect_renegotiates | 0 | | ||
| - | | Ssl_finished_connects | ||
| - | | Threads_connected | ||
| - | +--------------------------+-------+ | ||
| - | 7 rows in set (0.00 sec) | ||
| - | </ | ||
| - | |||
| - | Pay attention to the data " | ||
| - | |||
| - | ===== What are the maximum connections that mysql can have ===== | ||
| - | |||
| - | < | ||
| - | show variables like " | ||
| - | </ | ||
| - | |||
| - | ===== What are the maximum timeout that a connection will be kept open ===== | ||
| - | |||
| - | < | ||
| - | mysql> show variables like ' | ||
| - | +----------------------------+----------+ | ||
| - | | Variable_name | ||
| - | +----------------------------+----------+ | ||
| - | | connect_timeout | ||
| - | | delayed_insert_timeout | ||
| - | | innodb_lock_wait_timeout | ||
| - | | innodb_rollback_on_timeout | OFF | | ||
| - | | interactive_timeout | ||
| - | | lock_wait_timeout | ||
| - | | net_read_timeout | ||
| - | | net_write_timeout | ||
| - | | slave_net_timeout | ||
| - | | wait_timeout | ||
| - | +----------------------------+----------+ | ||
| - | 10 rows in set (0.00 sec) | ||
| - | </ | ||
| - | |||
| - | ===== Maybe c3p0 has the solution ===== | ||
| - | |||
| - | Eventually I've implemented a configuration in the connection pooling mechanism to: | ||
| - | |||
| - | * verify the connection when it enters into the pool | ||
| - | * put a timeout to this connection, releasing it after this period | ||
| - | |||
| - | This will prevent the case when a connection is held but the JDBC driver drops out. | ||
| - | |||
| - | My config parameters: | ||
| - | |||
| - | <code xml> | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | <!-- good for mysql. For oracle, select * from dual could be good enough --> | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | </ | ||
| - | |||
| - | And where I've taken them: | ||
| - | |||
| - | http:// | ||
| - | |||
| - | |||
| - | ===== Checking the log files ===== | ||
| - | |||
| - | I've put the status of the log to " | ||
| - | |||
| - | < | ||
| - | 07/24 12:09:14 hibernate.jdbc.ConnectionManager | ||
| - | </ | ||
| - | |||
| - | It seems that the hibernate continues to use their connection manager as he wants, ignoring completely the configuration I have for C3P0.... | ||
| - | |||
| - | Reading this: | ||
| - | |||
| - | http:// | ||
| - | |||
| - | ===== Issues about configuration of C3P0 and Hibernate ===== | ||
| - | |||
| - | I've discovered that, **the configuration for C3P0 goes into the configuration of hibernate**. | ||
| - | |||
| - | I have this: | ||
| - | |||
| - | <code xml> | ||
| - | <bean id=" | ||
| - | class=" | ||
| - | destroy-method=" | ||
| - | scope=" | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | |||
| - | </ | ||
| - | |||
| - | < | ||
| - | class=" | ||
| - | scope=" | ||
| - | < | ||
| - | < | ||
| - | [....] | ||
| - | </ | ||
| - | |||
| - | **And it's incorrect. This is the proper configuration: | ||
| - | |||
| - | <code xml> | ||
| - | <bean id=" | ||
| - | class=" | ||
| - | scope=" | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | < | ||
| - | </ | ||
| - | </ | ||
| - | | ||
| - | < | ||
| - | < | ||
| - | <prop key=" | ||
| - | <!-- for debug, put these values to " | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | |||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | |||
| - | < | ||
| - | Configuration for fixing the problem: | ||
| - | | ||
| - | The last packet successfully received from | ||
| - | the server was 7.202.618 milliseconds ago. | ||
| - | The last packet sent successfully to the | ||
| - | server was 7.202.618 milliseconds ago. | ||
| - | |||
| - | --> | ||
| - | <prop key=" | ||
| - | <!-- | ||
| - | In mysql, this value MUST be lower than wait_timeout. | ||
| - | You can check this out with the mysql command "show variables like ' | ||
| - | --> | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | <!-- good for mysql. For oracle, select * from dual could be good enough --> | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | <prop key=" | ||
| - | |||
| - | </ | ||
| - | </ | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | In other words, Hibernate must take care of configuring C3P0. I was so obsesed with Spring that I've forgot that some libraries do things in their own way. | ||
| - | |||
| - | |||
| - | |||
mysql/problemresolution.1374743623.txt.gz · Last modified: 2022/12/02 21:02 (external edit)
