Code snippet:
The code above is run via TIdHTTPServer.OnCommandGet, so is running in a separate thread. It works most of the time, but during testing, I noticed these 404 errors come up that I traced back to rct=nil in the code above. Maybe once every 15 times. The thread is launched via a bunch of almost identical ajax calls (in my tests, the code above is being called 3 times almost at once), so I'm thinking that it's some multi-threading issue with the RTTI unit. But my understanding is that it's thread-safe.
Anyone else had trouble like this?
Code:
uses
RTTI;
var
ctx: TRTTIContext;
rct: TRTTIType;
cn: String;
begin
// Lookup value and assign to cn;
// ... snip ...
rct := ctx.FindType(cn);
Assert(Assigned(rct));
end;
The code above is run via TIdHTTPServer.OnCommandGet, so is running in a separate thread. It works most of the time, but during testing, I noticed these 404 errors come up that I traced back to rct=nil in the code above. Maybe once every 15 times. The thread is launched via a bunch of almost identical ajax calls (in my tests, the code above is being called 3 times almost at once), so I'm thinking that it's some multi-threading issue with the RTTI unit. But my understanding is that it's thread-safe.
Anyone else had trouble like this?