Intermittent Error: Invalid attempt to Read when reader is closed.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
slaxman
Posts: 47
Joined: Wed 16 Sep 2009 20:09
Location: United States

Intermittent Error: Invalid attempt to Read when reader is closed.

Post by slaxman » Wed 07 Oct 2015 16:02

This error happens in our production system frequently but is not consistent. We have checked connections and network. No problems were identified. Also, the call stack is not available as the logging is minimal being production. If there is any bug in the code regarding the reader closing etc..., we would see the problem consistently. Interestingly, the reader is loading one row only. It is puzzling why the reader would close prematurely. Can you help?

Shalex
Devart Team
Posts: 8088
Joined: Thu 14 Aug 2008 12:44

Re: Intermittent Error: Invalid attempt to Read when reader is closed.

Post by Shalex » Wed 07 Oct 2015 16:38

Please check your code: is it possible that the same connection object is used in several threads simultaneously?

The PgSqlConnection instance is not guaranteed to be thread safe. You should avoid using the same PgSqlConnection in several threads at the same time. It is recommended to open a new connection per thread and to close it when the work is done.

Post Reply