Bug #90086 | MySqlDataReader is closed by an unrelated command disposal | ||
---|---|---|---|
Submitted: | 15 Mar 2018 10:10 | Modified: | 10 Aug 2022 18:43 |
Reporter: | Frédéric Delaporte | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 6.10.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | DataReader, Dispose, MySqlCommand, MySqlDataReaded, ResetReader |
[15 Mar 2018 10:10]
Frédéric Delaporte
[15 Mar 2018 11:11]
Frédéric Delaporte
A simingly workaround would be to always close previous commands before opening a reader, or to not close previous commands before having finished working with an opened reader. But this forces to handle a somewhat undue coupling between command lifecycle and reader lifecycle. Concrete case where this was discovered: polymorphic query with NHibernate returned as an Enumerable with deferred execution of reads on DataReader. Such a query results in as many commands as there are implementations of the queried entity, each command opening a reader with a safeguard in NHibernate enabled for databases not supporting multiple opened reader ensuring previously opened reader are read into memory and closed prior to the new reader opening. But the command of the reader transferred into memory is not disposed of at that moment due to separation of responsibilities concerns, but only a bit later, while another reader has already been opened. For more information on the context in which this bug has been found and why this creates coupling issues to have to account for this bug, you may read this comment: https://github.com/nhibernate/nhibernate-core/pull/1523#issuecomment-373338135
[16 Mar 2018 11:40]
Chiranjeevi Battula
Hello FRÉDÉRIC, Thank you for the bug report. In order to submit contributions you must first sign the Oracle Contribution Agreement (OCA). For additional information please check http://www.oracle.com/technetwork/community/oca-486395.html. If you have any questions, please contact the MySQL community team. Thanks, Chiranjeevi.
[7 Aug 2020 4:01]
Bradley Grainger
This no longer reproduces in 8.0.21. It was probably fixed in 8.0.20 by https://github.com/mysql/mysql-connector-net/commit/32e2faa1a515801cab8fbf05e77e78827f13c7....
[10 Aug 2022 18:43]
Daniel Valdez
Duplicated bug (Bug #89159)