mysql connector 连接报错, 客户端在 MySqlClient.MySqlDataReader.NextResult() 处报错 ,IIS 进程池 crash 后 db 端提示 Got an error reading communication packets 。异常时堆栈调用信息:ServerConnectionInfo.Finallize()=>ServerConnectionInfo.Dispose()=>MySqlConnection.Dispose()=>MySqlConnection.Close()=>MySqlDataReader.Close()=》MySqlDataReader.NextResult() 从堆栈调用信息来看,是从程序中发起了Dispose(),后再调用了MySqlConnection.Dispose()进行关闭。 在这里MySqlConnection.Close()又调用MySqlDataReader.Close()=》MySqlDataReader.NextResult(),从应用代码了解到MySqlConnection.Close()一般应为正常关闭的最后一步,而MySqlDataReader.Close()应在MySqlConnection.Close()之厚,这看起来是个非正常行为。 报错信息与connector 的 Bug#91106 NullReferenceException in Finalize crashes applications及Bug#90845 NullReferenceException on connection close比较匹配,易工已通过修改connetor源码进行测试。Bug#90845: Description:A NullReferenceException is thrown on MySqlConnection DisposeThe NullReference came from the setter of the property Reader.In the getter the driver has a null check but in the setter it is treated as a NotNull valueBug#91106Suggested fix: The MySqlDataReader that is used underneath by the command and dataadapter should have been disposed of when the commmand and dataadapter were disposed. I think that is probably a bug. If it wasn't disposed of correctly then, the finalize method should not assume the driver and driver.stream are not null. or you can catch these exceptions in dispose and not crash the program.
MYSQL connector 的 NullReferenceException bug
来源:这里教程网
时间:2026-03-01 15:22:49
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 淘太尉是如何实现淘宝首页添加一键直达微博链接的
淘太尉是如何实现淘宝首页添加一键直达微博链接的
26-03-01 - 这些著名数据库之间的“关系”,你知道吗?
这些著名数据库之间的“关系”,你知道吗?
26-03-01 - MySQL基准测试多线程复制的效率
MySQL基准测试多线程复制的效率
26-03-01 - MySQL死锁案例二(自增列导致死锁)
MySQL死锁案例二(自增列导致死锁)
26-03-01 - MySQL死锁案例一(回滚导致死锁)
MySQL死锁案例一(回滚导致死锁)
26-03-01 - MySQL死锁案例三(事务提交导致死锁)
MySQL死锁案例三(事务提交导致死锁)
26-03-01 - MySQL死锁案例四(删除和插入导致死锁)
MySQL死锁案例四(删除和插入导致死锁)
26-03-01 - MySQL:MySQL层比较函数调用
MySQL:MySQL层比较函数调用
26-03-01 - 利用 mysql-sandbox快速搭建MySQL测试环境
利用 mysql-sandbox快速搭建MySQL测试环境
26-03-01 - MySQL死锁案例五(两条更新导致死锁)
MySQL死锁案例五(两条更新导致死锁)
26-03-01
