NullReferenceException in finalizer cause apppool crashes
Posted by: Gurnek Singh
Date: September 29, 2017 12:48AM

An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/2/ROOT/myapp
Process ID: 25060
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace: at MySql.Data.MySqlClient.MySqlConnection.set_Reader(MySqlDataReader value)
at MySql.Data.MySqlClient.MySqlDataReader.Close()
at MySql.Data.MySqlClient.MySqlConnection.Close()
at MySql.Data.MySqlClient.MySqlConnection.Dispose(Boolean disposing)
at MySql.Data.MySqlClient.MySqlConnection.Finalize()

For curiosity sake, I checked source code and found that while setting reader on connection class, driver is not checked for null where in this whole class driver is always checked for Null before its usage.

Source\MySql.Data\Connection.cs - Line number 119

It might be a side-effect of bug fix in datareader.cs

// always ensure internal reader is null (Bug #55558)
connection.Reader = null;

MySql.Data 6.9.9 published on
MySql server version 5.5
.Net framework 4.6.2
Windows 2008 R2

Options: ReplyQuote

Written By
NullReferenceException in finalizer cause apppool crashes
September 29, 2017 12:48AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.