The code below is part of a much bigger function that has been working just fine for years.
It's in a loop of a batch, so it's called several hundred times within a loop.
But reliably, beginning just a couple weeks ago, it occasionally stops with the error "Variable does not contain a valid result set while getting result set next row." The error occurs two or three times within a thousand records. To get the records processed, I just run this again, and it works just fine -- it doesn't stop at any particular record for any particular reason.
My attempt to capture any error and prevent the problem is of no use - the cn.resultset.text is always "Success".
We are using pre-release 6194_5379 to help a little with the memory leak problem - I'm not sure if this error started with that patch or not. But if it works 98% of the time now and 100% of the time for years before, why shouldn't it work every time now?
I'm out of ideas on how to fix this, or catch it and provide a coded work-around.
It's in a loop of a batch, so it's called several hundred times within a loop.
But reliably, beginning just a couple weeks ago, it occasionally stops with the error "Variable does not contain a valid result set while getting result set next row." The error occurs two or three times within a thousand records. To get the records processed, I just run this again, and it works just fine -- it doesn't stop at any particular record for any particular reason.
My attempt to capture any error and prevent the problem is of no use - the cn.resultset.text is always "Success".
We are using pre-release 6194_5379 to help a little with the memory leak problem - I'm not sure if this error started with that patch or not. But if it works 98% of the time now and 100% of the time for years before, why shouldn't it work every time now?
I'm out of ideas on how to fix this, or catch it and provide a coded work-around.
Code:
dim AreYouSure as L = .f. dim distributed as n = 0 delete rsSure dim rsSure as sql::ResultSet sqlBeSure = <<%str% select isnull(sum(isnull(credit,0)),0) from journal_ar where LOCKBOX_REF = :rsSure_Bank_File_Name %str% args.set("rsSure_Bank_File_Name", rs.data("Bank_File_Name")) flagSure = cn.execute(sqlBeSure, args) if "Success" !$ cn.CallResult.text flagSure = .f. errtext = convert_type(now(), "C") + cn.callresult.text + crlf() + replace_arguments_in_string(sqlBeSure, args) + crlf(2) save_to_file(errText, errorLogFile, .t.) end if if flagSure rsSure = cn.ResultSet flagSure = rsSure.nextRow() ' <----- error is thrown on this line: not a valid result set if flagSure distributed = rsSure.data(1) end if end if
Comment