chkaufmann 17 Posted June 27, 2023 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
David Heffernan 2317 Posted June 27, 2023 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
Lars Fosdal 1746 Posted June 27, 2023 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
chkaufmann 17 Posted June 27, 2023 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