Bug #17291 | System.NullReferenceException: Object reference not set to an instance of an ob | ||
---|---|---|---|
Submitted: | 9 Feb 2006 21:55 | Modified: | 23 Jun 2006 12:38 |
Reporter: | Chida Chida | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 1.0.7.30072 | OS: | Windows (windows server 2003) |
Assigned to: | CPU Architecture: | Any |
[9 Feb 2006 21:55]
Chida Chida
[22 May 2006 8:51]
Torben K. Jensen
I have had a similar experience with MySqlDataAdapter.Update() calls, which also produced a NullReferenceException: at System.IO.BufferedStream.ReadByte() at MySql.Data.MySqlClient.PacketReader.ReadHeader() at MySql.Data.MySqlClient.PacketReader.OpenPacket() at MySql.Data.MySqlClient.NativeDriver.ReadResult(Int64& affectedRows, Int64& lastInsertId) at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst) at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume) at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand dataCommand, StatementType cmdIndex) at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataTable dataTable) The cause of the NullReferenceConnection seems to be that the MySQL server drops any connections it deems as having remained idle for too long. Needless to say, however, the error messages returned are not helpful. My advice, and the fix I have implemented, which seems to work, is to enable connection pooling and to close your database connections after any periodical operations are done. Do not maintain an open connection, which will remain mostly inactive, simply because it is convenient to do so.
[23 May 2006 12:38]
Tonci Grgin
Hi Chida, thanks for your problem report. If you can please provide me with following: MySQL server version DDL script Data dump Small but complete project showing this problem?
[23 Jun 2006 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".