Comments (13)
Interesting; I have a repro; this is actually caused by the disposal of the DbCommand object inside ExecuteReaderImpl. I am tempted to say that this is actually a bug in the firebird ADO.NET implementation - disposing the command does not usually kill the reader. I'm going to float this past the provider authors, to see what they think.
from dapper.
I have submitted a pull request to the provider (https://sourceforge.net/p/firebird/NETProvider/merge-requests/2/); there isn't much more I can do... I'm reluctant to not dispose the commands. Thoughts?
from dapper.
Thank you for dealing with this matter.
I agree with you . I also think this is a problem in FirebirdClient.
from dapper.
cheers; I can't force firebird to take the PR, but I've done what I can
from dapper.
Hi Marc. I'm the one responsible for FirebirdClient. Thanks for the patch (BTW there's a mirror on GitHub, which is more pleasant to work with, IMO), sadly it's wrong.
First the Dispose method itself also calls this.activeReader = null;
and this.statement = null;
, so just skipping closing reader in Release
is not enough.
Unfortunately as the code is now the reader itself needs command to fetch records. Initially only few are fetched (whatever fits the first response buffer) and then more is fetched as the buffer is processed. The command (actually something called "statement") holds the resources on server and handles all that and command keeps all the references etc. I know it's not a best design, but that's how it started and is now. :(
I wish to have some quick fix, but probably only a big rewrite would work. Could you not dispose the command before reader on your side?
from dapper.
Thanks for the reply. If the nulls were the only issue, it could of course
be tweaked to set those to null.
Re the command vs reader: it kinds sounds like at this point ownership has
passed to the reader, and thus the correct place to manage that is in the
reader, not the command. I fully sympathise, however, as one library author
to another, that this type of change is not trivial. Ultimately, the vexing
thing is that it works fine for every other ADO.NET provider.
Some of the APIs : yes, I could change the implementation to keep the
command action for longer. Not convenient, but possible. However, there is
also an API on dapper that returns the reader to the caller without ever
showing them the command. If I don't dispose the command, no-one ever will
(no-one else ever sees it). I can't wrap the reader, as the caller might
be casting to the provider-specific version for: reasons.
I guess I can patch up dapper to get by as best it can, but long term, I do
still think this is something that belongs in the reader...
Marc
On 6 Oct 2014 13:20, "Jiri {x2} Cincura" [email protected] wrote:
Hi Marc. I'm the one responsible for FirebirdClient. Thanks for the patch
(BTW there's a mirror on GitHub
https://github.com/cincuranet/NETProvider, which is more pleasant to
work with, IMO), sadly it's wrong.First the Dispose method itself also calls this.activeReader = null; and this.statement
= null;, so just skipping closing reader in Release is not enough.Unfortunately as the code is now the reader itself needs command to fetch
records. Initially only few are fetched (whatever fits the first response
buffer) and then more is fetched as the buffer is processed. The command
(actually something called "statement") holds the resources on server and
handles all that and command keeps all the references etc. I know it's not
a best design, but that's how it started and is now. :(I wish to have some quick fix, but probably only a big rewrite would work.
Could you not dispose the command before reader on your side?—
Reply to this email directly or view it on GitHub
#178 (comment)
.
from dapper.
Re the command vs reader: it kinds sounds like at this point ownership has
passed to the reader, and thus the correct place to manage that is in the
reader, not the command.
I agree. You can create (or I'll later) a ticket at tracker.firebirdsql.org. There's a couple of bad pieces of code there. I'm slowly trying to remove them.
I can't wrap the reader, as the caller might
be casting to the provider-specific version for: reasons.
I see. Probably only overriding casting operator would work. But that's hassle.
from dapper.
Overriding the casting simply operator isn't viable:
- the return type is IDataReader; you can't add a custom casting operator
to an arbitrary interface - the code that would need to do this doesn't know the type of reader, so
can't expose a custom conversion operator to that type - the reader comes
from ADO.NET; dapper does not include assembly references for firebird,
oracle, mysql, etc...
On 7 October 2014 05:49, Jiri {x2} Cincura [email protected] wrote:
Re the command vs reader: it kinds sounds like at this point ownership has
passed to the reader, and thus the correct place to manage that is in the
reader, not the command.I agree. You can create (or I'll later) a ticket at
tracker.firebirdsql.org. There's a couple of bad pieces of code there.
I'm slowly trying to remove them.I can't wrap the reader, as the caller might
be casting to the provider-specific version for: reasons.I see. Probably only overriding casting operator would work. But that's
hassle.—
Reply to this email directly or view it on GitHub
#178 (comment)
.
Regards,
Marc
from dapper.
OK, well. I think currently the FbDataReader
is out of business. Either I'll rework it or maybe somebody will contribute.
from dapper.
"out of business"?
On 7 October 2014 08:34, Jiri {x2} Cincura [email protected] wrote:
OK, well. I think currently the FbDataReader is out of business. Either
I'll rework it or maybe somebody will contribute.—
Reply to this email directly or view it on GitHub
#178 (comment)
.
Regards,
Marc
from dapper.
Like that it will not work with Dapper correctly.
from dapper.
Since dapper is just using ADO.NET here, it could be that it fails in a
number of other tools that use ADO.NET; but... it is what it is.
On 7 October 2014 09:23, Jiri {x2} Cincura [email protected] wrote:
Like that it will not work with Dapper correctly.
—
Reply to this email directly or view it on GitHub
#178 (comment)
.
Regards,
Marc
from dapper.
This has been "fixed" (worked around) in the most recent dapper commit - which wraps the reader such that the command's lifetime is linked to the reader. Not ideal, but it works.
from dapper.
Related Issues (20)
- .NET 8 - Fatal error - Attempted to read or write protected memory HOT 5
- Error executing the query using .net8 and postgres HOT 4
- Dapper add returnvalue is always int32 HOT 1
- Testing Query with string array parameter
- CustomPropertyTypeMap propertySelector does now allow null
- Why doesn't Dapper override fields in the entity class that are defined with default values when encountering null strings in the database? HOT 1
- Digitally sign Dapper assemblies HOT 4
- .NET 8.0 Internal connection fatal error HOT 2
- IDataReader Complex Mapping HOT 2
- Error on Postgres `ENUM` on first run HOT 4
- What is the correct way to pass a CancellationToken to QueryUnbufferedAsync? HOT 2
- Output parameter type Sql BIT to C# bool not working. HOT 2
- Support for Cancellation Tokens in QueryUnbufferedAsync Overloads HOT 2
- Dapper maps when all columns listed, but not with `*` for select list HOT 3
- @UniqueID error HOT 7
- QueryAsync with multiple joins - how to map a collection property?
- How to make LEFT JOIN multiple records for main records with limit TOP 1 for the main table. HOT 1
- Async Pipelined execution does not work with Microsoft.Data.SqlClient. HOT 2
- CVE-2024-0056 HOT 2
- Dapper QueryMultipleAsync does not pull multiple result sets HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dapper.