asyncer-io / r2dbc-mysql

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
https://r2dbc.io
Apache License 2.0
181 stars 18 forks source link

[bug] Connection unexpectedly closed #275

Closed andreas-ajaib closed 1 month ago

andreas-ajaib commented 2 months ago

Describe the bug A clear and concise description of what the bug is.

We frequently got Connection unexpectedly closed after updating to Spring Boot 2.7.x and asyncer:r2dbc-mysql 0.9.7.

Not stack trace, only this info:

"logger_name": "io.asyncer.r2dbc.mysql.client.ReactorNettyClient",
"message": "Connection unexpectedly closed"

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

jchrys commented 2 months ago

The issue arises because MySQL server disconnects your connection due to the wait_timeout setting. To address this, set your connection pool'smax idle timeout < wait_timeout value.

andreas-ajaib commented 2 months ago

Hmm. Interesting. I checked the those configs and the max_idle_timeout is already way way less than wait_timeout.

jchrys commented 2 months ago

I think we could help you further, If you could share us minimum reproducible steps.

Please ensure that you are returning your connection to the pool correctly. I suggest escalating this issue to r2dbc-pool, as they handle connection management.