-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
“ERROR: 57014: canceling statement due to user request” Npgsql 2.2.5 #344
Comments
Hello! I've caught same error (57014) yesterday with latest Dapper 1.42 and Npgsql 2.2.5. After upgrading npgsql to 3.0.2 the problem has gone. |
Hello, @horse315! Unfortunately the migration from 2.2 to 3.0 in Npgsql is not seamless. "Version 3.0 represents a near-total rewrite of Npgsql ... This means that you cannot expect to drop 3.0 as a replacement to 2.2 and expect things to work - upgrade cautiously and test extensively before deploying anything to production." (more can be found here http://www.npgsql.org/doc/migration-3.0.html) I believe that the fix for this issue is the reason you are not experiencing it in 3.0.2 npgsql/npgsql#615. |
@gyosifov |
Thank you @horse315 ! I have described in more detail my problem and two possible ways to get around it here - http://stackoverflow.com/questions/32632926/error-57014-canceling-statement-due-to-user-request-npgsql But since I cannot say what is the right way of dealing with it I need confirmation from the dapper team that this is the way Dapper should behave if not all refcursors have been read, when using Npgsql. 👍 |
This is a tricky one, not least because I'm not an expert with that On Fri, 25 Sep 2015 18:01 gyosifov [email protected] wrote:
|
My inclination is to close this out - simply because npgsql being so radically different between v2 and v3, it seems like we need to support v3 and the problems with v2 are just unfortunate. The complication of supporting both even plans into our test suites - testing both actually requires quite a bit of duplication, which seems like a short-term win for no long-term gain as people move off of v2. Thoughts here? I'm not as familiar with the ecosystem and I'm not sure what the split is on v2 vs. v3 userbase is. |
It is true that there are a lot of differences between v2 and v3 but this is not Dapper's fault. The point here is (by my opinion): is there enough justification for calling Cancel command in the Dispose method or is this a potential bug? From the only feedback I got from my question in SO, it seems that there are diverse opinions. |
Action for myself: I need to audit when cancel is/isn't called, and make
|
In the QueryMultiple method when not reading all of the refcursors of a PostgreSQL function the Dispose method of GridReader is invoked. Since the reader is not closed, command.Cancel() is called. (https://github.com/StackExchange/dapper-dot-net/blob/master/Dapper%20NET40/SqlMapper.cs#L4497)
Reading the user manual of Npgsql (http://www.npgsql.org/doc/manual-2.2.html) regarding the Cancel method it states:
"Npgsql is able to ask the server to cancel commands in progress. To do this, call the NpgsqlCommand’s Cancel method. Note that another thread must handle the request as the main thread will be blocked waiting for command to finish. Also, the main thread will raise an exception as a result of user cancellation. (The error code is 57014.)"
This causes code like this to throw exception if the first refcursor is empty:
Can you confirm if this is the desired result or is it an issue? Thank you!
The text was updated successfully, but these errors were encountered: