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

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

Postby 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?
slaxman
 
Posts: 47
Joined: Wed 16 Sep 2009 20:09
Location: United States

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

Postby 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.
Shalex
Devart Team
 
Posts: 7460
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle