#1 2021-01-27 20:01:20

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

mORMot2 TSynAutoCreateFields multithreaded trouble

I have some multithreaded code, where each thread creates and uses TSynAutoCreateFields-based instances of the same types. All these threads are pre-initialized (so they start almost at the same time).
This code works ok with 1.18, but with 2.0 I occasionally get random errors (mostly AV), for example at TRttiCustom.SetAutoCreateFields. Could it be that somehow threads are getting mixed at TSynAutoCreateFields-based class registering?

If I add Create/Destroy procedures for these classes before multithreaded processing (in other words - pre-registering them in the main thread) - all goes fine:

  TKommuneInfoCountyGeo.Create.Free;
  TKommuneInfoMunicipalityGeo.Create.Free;

Offline

#2 2021-01-28 10:22:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 TSynAutoCreateFields multithreaded trouble

Offline

#3 2021-01-28 10:29:34

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

Re: mORMot2 TSynAutoCreateFields multithreaded trouble

Yes, it works smoothly, now! Thanks smile

Offline

Board footer

Powered by FluxBB