TRoPooledFactory : maximum pool size reached

in your testcase, you have filled data from

procedure TMainForm.FormCreate(Sender: TObject);

in this case, putting LDA to fServerDataModule.pas will work perfectly.

if you should access to Service1_Impl from Service2_Impl, then drop LDA to another Service2_Impl.
after all data is read, just clear LDA.ServiceInstance.

last question, does LDA uses a pooled instance or does it create a new dataservice by default?

it uses the same settings what you have specified in initialization of _Impl, i.e. it looks for registered class factory and then creates instance according to class factory rules:

function LocalServiceAccessHelper_Acquire(aGuid: TGuid; aName: String): IDataAbstractLocalServiceAccess;
..
  GetClassFactory(aName).CreateInstance(aGuid, lLocal);

it seems that with a poolsize of 1, it is destroying and creating the service after the first call…
so initial create - consume - destroy - recreate service - consume -consume …

and if i clear the serviceinstance of the localdataadapter then the service gets destroyed also, so the classfactory behaviour is changed when using LDA…

LDA does not use an instance that is already in the pool…
it always creates it’s own
so either i accept the fact that there is 1 instance with apparently 1 connection which is dedicated for that one purpose OR i ditch LDA all together…
i mean if i see a scenario for 10 LDA then i end up with all connections (default 10) to be consumed and nothing goes…
is this by design?

as I’ve already said:

so when one instance in using, it just creates a new one:

procedure TROPooledClassFactory.CreateInstance(const aClientID : TGUID; out anInstance : IInterface);
..
        pbCreateAdditional:inherited CreateInstance(EmptyGUID, anInstance);//<<<<<

i stand corrected… the release of the instance by nilling the serviceinstance isn’t immediate apparently and thats why i got the impression that it is creating a new one every time…

you are using pbCreateAdditional - it allows to create instances over limit, try to change this value to pbFail or pbWait

no that is fine… was just checking what was created/destroyed when…
know localadapter isn’t for me in my scenario
i guess localserver and localchannel will perform likewise…

have you cleared LDA.ServiceInstance when table was opened and LDA isn’t required anymore?

yep

can you send to me updated testcase so I can check that you did everything correctly?

done

Thx.
I can reproduce issue.
workaround: update uDALocalHelpers.pas as

procedure LocalServiceAccessHelper_Release(aGuid: TGuid; aName: String; var aService: IDataAbstractLocalServiceAccess);
..
  lLocal := aService as IInterface; //changed

thx!

fix works as one should have expected :smile:

and i guess it will be in the next RODA release?

ofc, it was already added into v10

see also https://blogs.remobjects.com/2019/07/25/data-abstract-and-remoting-sdk-10/

looked briefly at the changes in source between 9.7 and 10 and i need to evaluate the impact …
are there any breaking changes that i didn’t notice?