c# - System.NullReferenceException in System.Data.RBTree`1.Minimum(Int32 x_id) -
i occationally getting null reference exception when running bitcoin node (written in c# .net 4.5). have been trying various apporaches, keeps coming up, after few hours, after server has been running uninterrupted days. unable provoke issue (cannot reproduce), , cannot see source of .net implementation of red-black-tree either. seems internal .net bug related clearing dataset. have exception trace here. appreciate feedback on how either correct issue or work around it, in case has had same odd experience.
hresult: -2146233088, 0x80131500 exception source: exception origin: exception stack: exception type: slf.cs.slfinternalerrorexception exception message: selectdata select statement: "select * [dbo].[blockheaders] blockhash = @equaltovalue" failed. slfexception info: hresult: -2146233088, 0x80131500 exception source: slf.cs exception origin: int32 selectdata(system.data.sqlclient.sqlconnection, int32, system.data.datatable, system.string, system.data.sqlclient.sqlparameter[]) exception stack: @ slf.cs.slfsqlutilities.selectdata(sqlconnection connection, int32 timeoutseconds, datatable datatable, string selectstatement, sqlparameter[] parameters) in c:\data files\development projects\iprotus\frameworks\slf.cs\system\basics\slfutilities.cs:line 1231 @ slf.cs.data.slfsqltable`1.select(string columnname, object equaltovalue, int32 maxcount, string orderbystatement) in c:\data files\development projects\iprotus\frameworks\slf.cs\system\database\sqlserver\slfsqldatabase.cs:line 950 @ slf.cs.cryptcoin.blockchaindb.getdbblockheadersbyblockhash(byte[] headerhash) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\basics\blockchaindb.cs:line 212 @ slf.cs.cryptcoin.blockchaindb.getblockheight(slfbyte32 blockhash) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\basics\blockchaindb.cs:line 856 @ slf.cs.cryptcoin.bitcoinstore.getblockheight(slfbyte32 hash) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\basics\bitcoinstore.cs:line 597 @ slf.cs.cryptcoin.bitcoinpeer.executegetheaderscommand(bitcoinmessage message) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\network\bitcoinpeer.cs:line 829 @ slf.cs.cryptcoin.bitcoinpeer.executecommand(bitcoinmessage message) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\network\bitcoinpeer.cs:line 1223 @ slf.cs.cryptcoin.bitcoinpeer.processnextcommand() in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\network\bitcoinpeer.cs:line 1591 @ slf.cs.cryptcoin.bitcoinpeer.run(object usercontext) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\network\bitcoinpeer.cs:line 1740 @ slf.cs.cryptcoin.bitcoinnode.peer(peercontext context) in c:\data files\development projects\iprotus\frameworks\slf.cs.cryptcoin\network\bitcoinnode.cs:line 857 @ slf.cs.slfpeertopeernode.internalpeerthread(peercontext context) in c:\data files\development projects\iprotus\frameworks\slf.cs\system\network\slfpeertopeernode.cs:line 1977 exception type: system.nullreferenceexception exception message: object reference not set instance of object. hresult: -2147467261, 0x80004003 exception source: system.data exception origin: int32 minimum(int32) exception stack: @ system.data.rbtree`1.minimum(int32 x_id) @ system.data.rbtree`1.successor(int32& nodeid, int32& maintreenodeid) @ system.data.rbtree`1.rbtreeenumerator.movenext() @ system.data.index.initrecords(ifilter filter) @ system.data.index.reset() @ system.data.datatable.resetinternalindexes(datacolumn column) @ system.data.datatable.clear(boolean clearall) @ system.data.datatable.clear() @ slf.cs.slfsqlutilities.filldatatable(sqldataadapter adapter, datatable datatable) in c:\data files\development projects\iprotus\frameworks\slf.cs\system\basics\slfutilities.cs:line 1299 @ slf.cs.slfsqlutilities.selectdata(sqlconnection connection, int32 timeoutseconds, datatable datatable, string selectstatement, sqlparameter[] parameters) in c:\data files\development projects\iprotus\frameworks\slf.cs\system\basics\slfutilities.cs:line 1222
--edit, due nature of initial comments--
look @ innermost exception trace. call standard datatable.clear() method, supposed remove datatable. rest doesn't matter. in hindsight, should have posted innermost exception.
furthermore, not see need provide sample code, 1 requested, since internal .net. concurrency related, tried circumvent wrapping datatable.clear() calls in lock on static object, , still happens. fact happens , random intervals indication concurrency issue. however, trying everything, gave , posted here, hoping else has issue solved :)
Comments
Post a Comment