Page 1 of 1

Access violation in TCustomDAConnection.DetectConnLostCause

Posted: Fri 20 May 2016 07:08
by VadimShvarts
ODAC and other DACs
Sometimes, when the connection is lost, we get an exception "Access violation at address 008FAA04 in module 'DSServer.exe'. Read of address 000000E0"
Error in function TCustomDAConnection.DetectConnLostCause
See comment in code

Code: Select all

function TCustomDAConnection.DetectConnLostCause(Component: TObject): TConnLostCause;
var
  i: integer;
  AllowFailOver: boolean;
begin
  Result := clUnknown;
  AllowFailOver := True;
  for i := FOperationsStackLen - 1 downto 0 do begin

    if Result < FOperationsStack[i].Operation then begin
      Result := FOperationsStack[i].Operation;
      AllowFailOver := FOperationsStack[i].AllowFailOver;
    end;

    case Result of
      clConnect: begin
//        if TCustomDAConnection(Component).FShouldShowPrompt then
{==Vs====================================================================}
        if Assigned(Component) and TCustomDAConnection(Component).FShouldShowPrompt then
{==Vs====================================================================}
          Result := clUnknown;// This is the first connect or non DisconnectedMode - so we should raise exception
        break;
      end;
      clOpen, clExecute: begin
        if ((Component is TCustomDADataSet) and not TCustomDADataSet(Component).IsQuery) or
          (Component is TCustomDASQL) then
          Inc(FConnectCount); // Add ConnectCount - > cause of EndConnection in TCustomDADataSet.DoAfterExecute
      end;
    end;
  end;

  if not AllowFailOver then
    Result := clUnknown;

  case Result of
    clExecute, clOpen, clServiceQuery, clTransStart:
      if not IsFailOverAllowed then
        Result := clUnknown;                    //can't perform FailOver cause of possible unnoticed server changes lost
  end;
end;
Correct it please
Thanks

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Posted: Mon 23 May 2016 09:06
by MaximG
Thank you for the information. Unfortunately, we can't edit the source code of our products without reproducing the issue. Please compose a complete simple sample reproducing the issue, and send it to maximg * devart * com

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Posted: Thu 02 Jun 2016 06:29
by VadimShvarts
We can not reproduce error on example, but on production environment sometimes we get this exception.
Error analysis shows that the procedure is executed DetectConnLostCause with parameter Component = nil

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Posted: Mon 12 Sep 2016 12:36
by MaximG
Unfortunately, we can't make changes in our products' source code without reproducing errors and investigation of reasons for their occurrence. You might reproduce the issue using a small test application. Its investigation will help us detect reasons for such behavior.