You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TMVCConnectionsRepository.RemoveConnection does not remove connection from fCurrentConnectionsByThread.
The new default connection is added by every operation within ActiveRecord class, but it is not removed from dictionary after finished operation in TMVCConnectionsRepository.RemoveConnection procedure.
The list in fCurrentConnectionsByThread stays unchanged. Moreover by every request there is still new ThreadID wich pointing to actual thread but the list is keeping all old thread IDs.
According to this #563 (comment) I have found possible reason of AV.
So I had to edit MVCFramework.ActiveRecord.pas to temporary solve this issue.
procedure TMVCConnectionsRepository.RemoveConnection(const aName: string;
const RaiseExceptionIfNotAvailable: Boolean = True);
var
lName: string;
lKeyName: string;
lConnHolder: TConnHolder;
begin
lName := aName.ToLower;
lKeyName := GetKeyName(lName);
fMREW.BeginWrite;
try
if not fConnectionsDict.TryGetValue(lKeyName, lConnHolder) then
begin
if RaiseExceptionIfNotAvailable then
begin
raise Exception.CreateFmt('Unknown connection %s', [aName])
end
else
begin
Exit;
end;
end;
fConnectionsDict.Remove(lKeyName);
//ADDED to remove actual connection from thread dictionary - issue 563
fCurrentConnectionsByThread.Remove(TThread.CurrentThread.ThreadID);
try
FreeAndNil(lConnHolder);
except
on E: Exception do
begin
LogE('ActiveRecord: ' + E.ClassName + ' > ' + E.Message);
raise;
end;
end;
finally
fMREW.EndWrite;
end;
end;
The text was updated successfully, but these errors were encountered:
TMVCConnectionsRepository.RemoveConnection does not remove connection from fCurrentConnectionsByThread.
The new default connection is added by every operation within ActiveRecord class, but it is not removed from dictionary after finished operation in TMVCConnectionsRepository.RemoveConnection procedure.
The list in fCurrentConnectionsByThread stays unchanged. Moreover by every request there is still new ThreadID wich pointing to actual thread but the list is keeping all old thread IDs.
According to this #563 (comment) I have found possible reason of AV.
So I had to edit MVCFramework.ActiveRecord.pas to temporary solve this issue.
The text was updated successfully, but these errors were encountered: