While debugging a delphi RO server I get a crash because Connection=nil of the TDARemoteService object
What could cause this?
Should this typically be checked?
Note: The error occured for a hydra call
if Supports (FLocalService, IOffServerService, lService) then
begin
Try
lService.GetBestelInfo (...);
Finally
FLocalService.ReleaseInstance();
End;
Note: The THYLocalService ReleaseInstance function also throws the ‘Instance has never been created’ exception
The call succeeded multiple times but then failed without restart of the RO server
RO service is pooled
fClassFactory_OffServerService := TROPooledClassFactory.Create(‘OffServerService’, Create_OffServerService, TOffServerService_Invoker, 3, pbCreateAdditional,True);
There is a DASchema on the RO service which has a ConnectionManager configured
DASchema.ConnectionManager:=ServerForm.ConnectionManager;
There are only 4 DB connections in the pool
FLocalService := THYLocalService.Create(nil); gets created by a singleton at program launch time.
I can suggest to add some logging to OnAfterAcquireConnection / OnAcquireConnectionFailure / OnBeforeReleaseConnection events and see if connection was created & freed correctly.
procedure TDARemoteService.DoOnActivate(aClientID: TGUID; const aMessage: IROMessage);
...
fConnection := ServiceSchema.ConnectionManager.NewConnection(connname);
...
if Assigned(fOnAfterAcquireConnection) then fOnAfterAcquireConnection(Self, connname, fConnection);
except
on E: Exception do begin
if Assigned(fOnAcquireConnectionFailure) then fOnAcquireConnectionFailure(Self, connname, E);
raise;
end;
end;
end;
procedure TDARemoteService.DoOnDeactivate(aClientID: TGUID);
...
if Assigned(fOnBeforeReleaseConnection) then fOnBeforeReleaseConnection(Self, connname, fConnection);
fConnection := nil;
...
end;