-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection leak with spring-r2dbc #45
Comments
Hi. We have the problem with connections too, in logs we see the error message "Connection is close. Cannot send anything". r2dbc-mariadb version: 1.1.2 @mindfn Are these related issues? |
I'm not sure, "Connection closed" occurs in many scenarios. |
problem reproduced. |
not sure that is related to other cases describe there, but initial issue correction is available using SNAPSHOT release :
|
Thank you. It seems to work, we will update to the latest version to verify. |
r2dbc-mariadb version: 1.1.2
r2dbc-pool: 0.9.0
spring-r2dbc: 5.3.21
When Exchange pushes a msg (not the ending packet) through emit , the sink may be set to the completed state by the subscriber, and if other sql continues to execute on the same connection, it may trigger connection leakage.
The problem was triggered when we tried to execute a count statement within a transaction.
Here is the complete command processing:
We use the DatabaseClient from spring-r2dbc to execute the query ,and spring-tx to manager tx, it only gets the first [RowPacket] internally as the query result, and immediately triggers onComplete, which triggers a transaction's COMMIT.
The COMMIT is executed before the [EofPacket] has been processed. After that, two consecutive packets need to be processed, but the FluxReceve.receiverDemand is not updated.
So the [OKPacket ] of COMMIT is discarded, causing the connection not to be released from the connection pool, a connection leak has occurred.
I made the following changes to prevent this problem from happening .
Is there any other more appropriate way to prevent this problem from happening?
@rusher
Thanks.
The text was updated successfully, but these errors were encountered: