Access violation in TCustomDAConnection.DetectConnLostCause

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
VadimShvarts
Posts: 34
Joined: Mon 22 Dec 2008 09:03

Access violation in TCustomDAConnection.DetectConnLostCause

Post by VadimShvarts » Fri 20 May 2016 07:08

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

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Post by MaximG » Mon 23 May 2016 09:06

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

VadimShvarts
Posts: 34
Joined: Mon 22 Dec 2008 09:03

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Post by VadimShvarts » Thu 02 Jun 2016 06:29

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

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Access violation in TCustomDAConnection.DetectConnLostCause

Post by MaximG » Mon 12 Sep 2016 12:36

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.

Post Reply