Closed luronumen closed 1 year ago
The connection pool should be re-established in the second attempt without any exceptions
That's exactly what's not 100% reliably possible. Even if I check that the connection is OK, the second I give it to you, the connection might become broken. Hence you'd still need to have some recovery logic in place (in fact this was even described in ADO.NET/SqlClient documentation).
Hi @cincuranet
Many thanks for your quick response!
It wasn't clear to me from reading your comment whether you considered this to be a valid issue.
Note that when calling the SelectProcedure method after deleting the connection pool on the server side, an FbException is expected to occur in the try block of the method that is handled in the catch block. Note that in the catch block the method is called again, for the second time, and it is precisely here in this second call where a new connection pool should be opened and no more exceptions should happen: This is the issue!
The implementation of this method has worked very well in other situations when for example the FirebirdSQL service is restarted or when the database connection is lost for some network reason.
Another important piece of information is that the error message has changed since version 8.0.0:
Version 7.10.1 - Friday, December 4, 2020 (12/4/2020): Unable to complete network request to host " No message for error code 335544721 found.
Version 8.0.0 - Thursday, April 1, 2021 (4/1/2021): Error writing data to the connection. Error reading data from the connection.
Best Regards, Luciano
The message is the same as in this unresolved issue Behind could be another one that could help on solving it
@luronumen Can you also upload database (or at least structure to run your example)?
Hi @cincuranet
I have attached the NETProvider_1095.zip .NET 7.0 console application containing:
Please let me know if you also able to reproduce the issue.
Best Regards, Luciano
OK, the problem is that in this case the connection is "closed gracefully" from server-side ("connection shutdown" response) and because that's not broken socket (yet), the connection goes back to pool. Retrying again would solve it itself. But it should be handled nevertheless.
Hi @cincuranet
Many thanks for debugging this issue!
As you can see in the Program.cs class, the SelectProcedure method automatically makes a second attempt (line 26) when the first attempt fails (line 20) but the connection is not reestablished: This is the bug!
I have a service running on Windows and in some cases this reconnection only happens after several minutes as you can see in the log below:
Please let me know when a fix for this bug is available so I can help you retest it.
Best Regards, Luciano
As you can see in the Program.cs class, the SelectProcedure method automatically makes a second attempt (line 26) when the first attempt fails (line 20) but the connection is not reestablished: This is the bug!
You'd need to retry for 3rd time.
Hi @cincuranet
Is trying a third time a temporary workaround or is the current behavior not considered a bug?
In your case the 3rd retry is workaround. Regarding bug, yes, it's a bug.
Closing in favor if specific #1097.
Hi @cincuranet
Thank you very much for the confirmation! Please let me know when you have the fix so I can help you validate it.
Meanwhile I will use the workaround replacing the line 25:
if (poolingStatus)
by
if (poolingStatus || fbException.ErrorCode == 335544727) //See https://github.com/FirebirdSQL/NETProvider/issues/1095
Best Regards, Luciano
Please let me know when you have the fix so I can help you validate it.
Keep watching #1097 and you'll catch when it's done.
Actual Result
Expected Result
Steps to Reproduce the Issue
Important Notes
Environment Setup