You are not logged in.
Hello everybody , I am encountering an issue when stopping my server, which is built using mORMot2. When I close the server, I get the following exception:
! EXC ERestException {Message : "TMYRestServerDb.destroy : TRestOrmServerDb.RefCount = 201"} [Main] at 68ad63
Offline
I guess your code have a confusion between IRestOrm and TRestOrm instances.
Or you are keeping some references to IRestOrm somewhere in your code, at shutdown.
You need to clean all IRestOrm references before shutting down the server.
Offline
Hello,
I have a `Start` and `Stop` function for my server. In the `Start` function, I initialize some data in the database by calling multiple initialization functions like:
initSomething1(varRest: IRestOrm);
{
varRest.orm.add()
}
initSomething2(varRest: IRestOrm);
{
varRest.orm.add()
}
Each of these functions works with `varRest: IRestOrm` to initialize data.
In the `Stop` function, I free my `TRestHttpServer` and `TRestServerDb` variables as follows:
procedure TDeamon.Stop;
begin
TSynLog.Enter(self);
DbContext.Destroy;
restHttpServer.Free;
restServerDb.Free;
end;
To avoid reference count issues, I explicitly set `varRest := nil` in each `initSomething()` function. However, I still encounter the same exception when stopping the server:
! EXC ERestException {Message : "TINYRestServerDb.destroy : TRestOrmServerDb.RefCount = 201"}
any insights on what could still be holding references to `IRestOrm`?
Offline