c# - Quickfix Error : System.AccessViolationException -


i have quickfix .net application. using .net/c++ version of quickfix

sometimes application throws error , cannot catch try catch block. lenght of fix messages 3000. don't error everytime. event log :

framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: system.accessviolationexception stack: @ system.string..ctor(sbyte*) @ quickfix.group.getfield(quickfix.stringfield) @ fixapplication.onmessage(quickfix44.marketdataincrementalrefresh, quickfix.sessionid) @ quickfix44.messagecracker.crack(quickfix.message, quickfix.sessionid) @ quickfix.messagecracker.crack(quickfix.message, quickfix.sessionid, quickfix.beginstring) @ quickfix.messagecracker.crack(quickfix.message, quickfix.sessionid)
@ fixapplication.fromapp(quickfix.message, quickfix.sessionid) @ .application.fromapp(application*, fix.message*, fix.sessionid*)

the line throws error :

public override void onmessage(quickfix44.marketdataincrementalrefresh msg, sessionid sessionid) {   try   {        var mdreqid = new mdreqid();       if (msg.isset(mdreqid))         msg.get(mdreqid);       var nomdentries = new nomdentries();       if (msg.isset(nomdentries))         msg.get(nomdentries);       int nomdentriesint;       if (int32.tryparse(nomdentries.tostring(), out nomdentriesint))       {         (uint = 1; <= nomdentriesint; i++)         {           var group = new marketdataincrementalrefresh.nomdentries();           group repeateddata;           if (msg.isset(nomdentries))           {             repeateddata = msg.getgroup(i, group);             var mdupdateaction = new mdupdateaction();             if (repeateddata.issetfield(mdupdateaction))               repeateddata.getfield(mdupdateaction);             var mdentrytype = new mdentrytype();             if (repeateddata.issetfield(mdentrytype))               repeateddata.getfield(mdentrytype);              var symbol = new symbol();             if (repeateddata.issetfield(symbol))               repeateddata.getfield(symbol);             var mdentrypx = new mdentrypx();             if (repeateddata.issetfield(mdentrypx))               repeateddata.getfield(mdentrypx);             var mdentrysize = new mdentrysize();             if (repeateddata.issetfield(mdentrysize))               repeateddata.getfield(mdentrysize);             var numberoforders = new numberoforders();             if (repeateddata.issetfield(numberoforders))               repeateddata.getfield(numberoforders);              var mdentrypositionno = new mdentrypositionno();             if (repeateddata.issetfield(mdentrypositionno))               repeateddata.getfield(mdentrypositionno);              var quotecondition = new quotecondition();             if (repeateddata.issetfield(quotecondition))               repeateddata.getfield(quotecondition);               var syssymbolid = 0;             var mdentryid = new mdentryid();             if (repeateddata.issetfield(mdentryid))             {               repeateddata.getfield(mdentryid);//this line throws error               string strmdentryid = mdentryid.getvalue();              }             //}           }         }       }     }     functions.writedebuglog("ok");   }   catch (win32exception e)   {     functions.writesystemlog("ex msg:" + e.tostring() + " fix msg : " + msg.tostring());   }   catch (exception ex)   {     functions.writesystemlog("ex msg:" + ex.tostring() + " fix msg : " + msg.tostring());   }  } 

this fix msg (you can parse online tool : http://fixloganalyzer.com/ ):

8=fix.4.4|9=2254|35=x|34=21998|49=*|50=*|52=20140411-07:52:52.472|56=**|262=1397202772472|268=42|279=1|278=25500|270=2.11636|271=3500000|276=a|290=1|279=1|278=25501|270=2.11626|271=2000000|276=a|290=2|279=1|278=25502|270=2.11616|271=3000000|276=a|290=3|279=1|278=25504|270=2.11596|271=7000000|276=a|290=5|279=1|278=25510|270=2.11716|271=3500000|276=a|290=1|279=1|278=25512|270=2.11736|271=5000000|276=a|290=3|279=1|278=25513|270=2.11746|271=5000000|276=a|290=4|279=1|278=25514|270=2.11756|271=6000000|276=a|290=5|279=1|278=204|270=1.38947|271=1500000|276=a|290=5|279=1|278=600|270=0.93834|271=1000000|276=a|290=1|279=1|278=601|270=0.93833|271=1000000|276=a|290=2|279=1|278=602|270=0.93832|271=1000000|276=a|290=3|279=1|278=603|270=0.93831|271=2000000|276=a|290=4|279=1|278=604|270=0.93821|271=2000000|276=a|290=5|279=1|278=610|270=0.93839|271=1000000|276=a|290=1|279=1|278=611|270=0.9384|271=1500000|276=a|290=2|279=1|278=613|270=0.93843|271=3500000|276=a|290=4|279=1|278=614|270=0.93844|271=3000000|276=a|290=5|279=1|278=2200|270=1.09337|271=1000000|276=a|290=1|279=1|278=2201|270=1.09336|271=1000000|276=a|290=2|279=1|278=2203|270=1.09334|271=4000000|276=a|290=4|279=1|278=2204|270=1.09333|271=1000000|276=a|290=5|279=1|278=2211|270=1.09344|271=2000000|276=a|290=2|279=1|278=2214|270=1.09356|271=3000000|276=a|290=5|279=1|278=19600|270=1.08182|271=1000000|276=a|290=1|279=1|278=19601|270=1.08181|271=1000000|276=a|290=2|279=1|278=19602|270=1.0818|271=1000000|276=a|290=3|279=1|278=19603|270=1.08179|271=1000000|276=a|290=4|279=1|278=19604|270=1.08178|271=1000000|276=a|290=5|279=1|278=19612|270=1.08205|271=1000000|276=a|290=3|279=1|278=19613|270=1.08206|271=1000000|276=a|290=4|279=1|278=19614|270=1.08216|271=2000000|276=a|290=5|279=1|278=23600|270=1.51927|271=2000000|276=a|290=1|279=1|278=23601|270=1.51926|271=1000000|276=a|290=2|279=1|278=23602|270=1.51925|271=1000000|276=a|290=3|279=1|278=23603|270=1.51915|271=3000000|276=a|290=4|279=1|278=23604|270=1.51905|271=4000000|276=a|290=5|279=1|278=23610|270=1.51945|271=1500000|276=a|290=1|279=1|278=23611|270=1.51946|271=1000000|276=a|290=2|279=1|278=23612|270=1.51947|271=1000000|276=a|290=3|279=1|278=23613|270=1.51957|271=2000000|276=a|290=4|279=1|278=23614|270=1.51967|271=3000000|276=a|290=5|10=142|

this looks related.

it's race condition in group object, gets garbage collected before referenced.

you want gcnew per: .net garbage collection


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -