Jump to content
chkaufmann

Access violation in library code

Recommended Posts

I have an error in my application. It happens from time to time on my server, but I cannot reproduce it.

 

The call stack from madExcept looks like this:

exception number         : 1
exception class          : EAccessViolation
exception message        : Access violation at address 0040BB2E in module 'Logo12RestAPI.exe'. Read of address FFFFFFF9.

thread $1b78 (TIdThreadWithTask):
0040bb2e Logo12RestAPI.exe System                22 @UStrAsg
022e67aa Logo12RestAPI.exe geoRefBOImp           60 {System.Generics.Collections}TDictionary<System.string,mainBO.IBasispunkt>.DoAdd
022e7303 Logo12RestAPI.exe geoRefBOImp           60 {System.Generics.Collections}TDictionary<System.string,mainBO.IBasispunkt>.AddOrSetValue
022e5e1f Logo12RestAPI.exe geoRefBOImp         1580 {BSCollectionsImp}TBSDictionary<System.string,mainBO.IBasispunkt>.SetElements
022d5fa5 Logo12RestAPI.exe geoRefBOImp         1586 TLocation.GetBasispunkt
022d7cff Logo12RestAPI.exe geoRefBOImp         1890 TLocation.Ukm
00411300 Logo12RestAPI.exe System                22 @IntfClear
00411321 Logo12RestAPI.exe System                22 @IntfCopy
00411300 Logo12RestAPI.exe System                22 @IntfClear
02847e35 Logo12RestAPI.exe restAPIServer       1306 TRestAPIGetEntities.Basispunkte

 

Can anybody give me a hint, where the problem could be located? I work with Delphi 11, Version 28.0.44500.8973.

 

Christian

Share this post


Link to post

You've got some memory corruption or broken interface handling code. It could be pretty much anywhere. You might get a better steer using FastMM with full debug options. 

Share this post


Link to post

That FFFFFFF9 address looks like a nil reference negative offset.

Does TBSDictionary.SetElements check the validity of the references?

Share this post


Link to post
22 minutes ago, Lars Fosdal said:

That FFFFFFF9 address looks like a nil reference negative offset.

Does TBSDictionary.SetElements check the validity of the references?

No, there is no such check in SetElements. In this case here, these are persistent objects. But I added a TMonitor.Enter / Leave arround the access of TBSDictionary/TDictionary since the code runs in an application with multiple threads and it may happen, that two threads run the method GetBasispunkt for the same object at the same time. Since the error is not reproducable, this may solve the problem.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×