The last packet sent successfully to the server was 0 milliseconds ago

Source: Internet
Author: User

An exception occurred "The last packet sent successfully to the server was 0 milliseconds ago." Most of the reason is because the database recycles the connection, and the system's buffer pool is not known, and continues to use the recovered connection.

Take MySQL for example:

The first solution is to get MySQL to reclaim idle connections longer, MySQL default recycle time is 8 hours, you can add the following configuration in the MySQL directory My.ini, change the time to 1 days.

The unit is seconds, the maximum seems to be 24 days:

[Mysqld]

wait_timeout=86400

The second solution, can be configured to let the buffer pool to test whether the connection is recycled, if it is recycled, then do not continue to use, in DBCP as an example:

          #SQL查询 To verify connections taken from the connection pool            Dbcp.validationquery=select 1           # Indicates whether the connection is checked by the Idle connection collector (if any), and if the detection fails, the connection is removed from the pool           Dbcp.testwhileidle=true           #在空闲连接回收器线程运行期间休眠的时间值, measured in milliseconds, Generally smaller than Minevictableidletimemillis           dbcp.timebetweenevictionrunsmillis=300000           #在每次空闲连接回收器线程 ( If there is a run-time check of the number of connections, preferably with maxactive consistent          dbcp.numtestsperevictionrun=50           #连接池中连接, the time period that has been idle, was evicted from the connection pool (1000*60*60), in milliseconds            dbcp.minevictableidletimemillis=3600000

The last packet sent successfully to the server was 0 milliseconds ago

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.