CSPRO crashes Exception Code c0000005

Discussions about CSEntry
Post Reply
Harry
Posts: 7
Joined: June 17th, 2021, 7:16 pm
Location: Costa Rica

CSPRO crashes Exception Code c0000005

Post by Harry » June 26th, 2021, 11:39 pm

Dear CSPRO users,

I have an entry applicaton and CSPRO is crashing with the Exception Code c0000005. This is the report of the crash:
Problem signature:
Problem Event Name: BEX
Application Name: CSEntry.exe
Application Version: 7.5.0.0
Application Timestamp: 5fdfd142
Fault Module Name: StackHash_0a9e
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Offset: a0458365
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 5130
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789



I tested it with CSPRO 7.5 and 7.6 with the same results. After a review of the logic, I think is something related with the setfile or close of an external data inside a while loop. My application is long, so I decided to write a very small application just to reproduce the problem. This is the test application:

PROC GLOBAL
PROC APP1DICT_FF

PROC DATA0
while $ > 0 do
setfile(EXTERNAL_DICT, "DATATEST.DAT");
if loadcase(EXTERNAL_DICT,$) then
errmsg("Case found %s",data00);
delcase(EXTERNAL_DICT);
else
errmsg("Case does not exist");
endif;
close(EXTERNAL_DICT);
reenter;
enddo;

I am attaching this test applicaton for review.

Kind regards

Harry Hernandez
Attachments
cspro76test2.zip
(6.33 KiB) Downloaded 20 times

Gregory Martin
Posts: 1536
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: CSPRO crashes Exception Code c0000005

Post by Gregory Martin » June 28th, 2021, 8:07 am

Odd. I ran your test program using CSPro 7.5 and 7.6 and I have no issues with it. It successfully shows me the case to delete, and I can do this multiple times (meaning the close/setfile work). Does this specific test application not work on your machine?

More generally, is there a reason to close/open the file multiple times? Unless you are sharing the file with multiple applications that are running at the same time, we discourage people from closing/opening files. That was a common practice, and sometimes a necessary practice, prior to CSPro 7.x, but is less necessary now.

Another thing you can do to test the issue is to use a CSPro DB file instead of a text file for your external data file. If that runs without problem, that would give us a clue to the problem.

Harry
Posts: 7
Joined: June 17th, 2021, 7:16 pm
Location: Costa Rica

Re: CSPRO crashes Exception Code c0000005

Post by Harry » June 28th, 2021, 4:52 pm

Thanks Gregory for your answer.
If you run the applicaton in windows 10 it crashes without any message. When I run the application in windows 7 professional, it crashes but also produces the Exception Code c0000005.

I did a couple of changes in the application, first it changes the .dat file to .csdb, and the problem continues with the .csdb file. Also I put a message at the end "Program ended", if you do not receive this message and the applicaton closes it means the application crashed.

Your comment about why I need to close and open the file several times, I need it in this way, because it calls another programs to use this data.

Kind regards

Harry Hernandez
Attachments
cspro76test 3.zip
(12.07 KiB) Downloaded 20 times

Gregory Martin
Posts: 1536
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: CSPRO crashes Exception Code c0000005

Post by Gregory Martin » June 29th, 2021, 10:48 am

I can reproduce the problem now. In case you are interested in the technical details, when you call writecase or delcase in a loop, a SQLite transaction is started so that they operate quickly when you do many such operations in a loop. We did not account for the fact that you can close the file within the loop, so this is that is leading to the problem.

I have fixed the problem and it will be part of CSPro 7.6.2. To avoid the problem for now, you can trick CSPro by doing something like this, wrapping the delcase call in a fake loop:
while true do
    delcase
(EXTERNAL_DICT);
   
break;
enddo;

Harry
Posts: 7
Joined: June 17th, 2021, 7:16 pm
Location: Costa Rica

Re: CSPRO crashes Exception Code c0000005

Post by Harry » June 29th, 2021, 3:43 pm

Thanks Greogry for the quick response and solution.
Kind regards
Harry Hernandez

Post Reply