Random invalid results coming back for data reader
Posted: Tue 26 May 2009 21:04
We are using the 4.0 version of the drivers.
What the problem we are currently experiencing is randomly we'll have an invalid data reader returned. By invalid I mean I ask for it to return me columns such as patientid, ssn, bdate and instead what I get back in my datareader is a single column and the column is labelled id. So since it is randomness, that sort of leads me to believe threading. We do have parts of our application that is threaded. But the areas we are getting the errors in are part of the main thread. Since I'm sure this will be asked, here's how we're working with connections in the threaded environment.
We have a helper method that basically instantiates a new instance of a pgsqlconnection object and opens it. It also creates a command object and sets the query to execute. It then returns the data reader. We are not using a shared connection. So we do not think this will cause any problems in a threaded environment because we are not reusing the connection object itself. We are using connection pooling and since we do create so many new connection objects, turning that off is NOT an option.
In addition, we do not have a sample project that we can show and even if we did, as I mentioned this is random. Meaning somebody may get it once every couple of days.
As a side note our application did not have this problem in our previous version when we were using the 3.75 drivers.
Any advice on what to look for or considerations in threaded environments would be helpful given the current situation I described.
What the problem we are currently experiencing is randomly we'll have an invalid data reader returned. By invalid I mean I ask for it to return me columns such as patientid, ssn, bdate and instead what I get back in my datareader is a single column and the column is labelled id. So since it is randomness, that sort of leads me to believe threading. We do have parts of our application that is threaded. But the areas we are getting the errors in are part of the main thread. Since I'm sure this will be asked, here's how we're working with connections in the threaded environment.
We have a helper method that basically instantiates a new instance of a pgsqlconnection object and opens it. It also creates a command object and sets the query to execute. It then returns the data reader. We are not using a shared connection. So we do not think this will cause any problems in a threaded environment because we are not reusing the connection object itself. We are using connection pooling and since we do create so many new connection objects, turning that off is NOT an option.
In addition, we do not have a sample project that we can show and even if we did, as I mentioned this is random. Meaning somebody may get it once every couple of days.
As a side note our application did not have this problem in our previous version when we were using the 3.75 drivers.
Any advice on what to look for or considerations in threaded environments would be helpful given the current situation I described.