Delphi FireDac application blocking with unavailable host
<p>Source: Delphi XE10; Os: W10; Database server: FB 2_5_1;</p>

<p>I created client application to connect more than one database. My application create TSource->Create TThread -> create DataModule with FDConnection. 
Every TSource have own TThread which have own DataModule;</p>

<p>To tests I have two definitions: HostLocal and HostRemote; 
My Test:
a)Run: Connection.Open for HostRemote; 
b)Next Run: Connection.Open for HostLocal;</p>

<p>When HostRemote is unavailable than HostLocal wait for I dont know for what.
 Why unavailable connection blocked another correct connection?</p>

<p>EDIT:
Database Server was updated to 3.0.0</p>

<p>Code:</p>

<pre><code>    begin
      Application.Initialize;
      Application.CreateForm(TFormMain, FormMain);
      Application.Run;
    end.
</code></pre>

<p>unit UnitFormMain;</p>

<pre><code>    procedure TFormMain.FormCreate(Sender: TObject);
    begin
      Source0 := TFormSource.Create(Self);
      Source1 := TFormSource.Create(Self);
    end;

    procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      FreeAndNil( Source0 );
      FreeAndNil( Source1 );
    end;

    procedure TFormMain.Button1Click(Sender: TObject);
    begin
      Source0.Show;
      Source1.Show;

      Source0.ThStart( 0 );
      Source1.ThStart( 1 );
    end;
</code></pre>

<p>unit UnitFormSource;</p>

<pre><code>    TFormSource = class(TForm)
        Memo: TMemo;
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        th: TMyThread;
      public
        procedure ThStart( value: Integer );
        procedure MyTerminate( Sender: TObject );
      end;
    ...
    procedure TFormSource.FormCreate(Sender: TObject);
    begin
      th := TMyThread.Create( TRUE );
      th.OnTerminate := MyTerminate;
      th.Priority := TThreadPriority.tpLower;
      th.FreeOnTerminate := TRUE;
    end;

    procedure TFormSource.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      FreeAndNil( th );
      Action := TCloseAction.caFree;
    end;

    procedure TFormSource.ThStart(value: Integer);
    begin
      th.SetSwitch( value );
      th.Resume;
      Memo.Lines.Add( TimeToStr(Now) + ' Start' );
    end;

    procedure TFormSource.MyTerminate(Sender: TObject);
    begin
      Memo.Lines.Add( TimeToStr(Now) + ' Terminate' );
    end;
</code></pre>

<p>unit UnitThread;</p>

<pre><code>    TMyThread = class(TThread)
      private
        Switch: Integer;
        dm: TDMFireBird;
      protected
        procedure Execute; override;
      public
        constructor Create(CreateSuspended: Boolean);
        destructor Destroy; override;
        procedure SetSwitch(value: Integer);
      end;
    ...
    constructor TMyThread.Create(CreateSuspended: Boolean);
      begin
        inherited Create(CreateSuspended);
        dm := TDMFireBird.Create(nil);
        Switch := -1;
      end;

      destructor TMyThread.Destroy;
      begin
        FreeAndNil(dm);
        inherited;
      end;

      procedure TMyThread.Execute;
      begin
        with dm.FDConnection.Params do
        begin
          Clear;
          Add('DriverID=FB');
        end;

        case Switch of
          0:
            with dm.FDConnection.Params do
              Add('Protocol=Local');
          1:
            with dm.FDConnection.Params do
            begin
              Add('Protocol=TCPIP');
              Add('Server=10.0.0.1'); // unavailable connection - server not exist
              Add('Port=3050');
            end;
        end;
        with dm.FDConnection.Params do
        begin
          Add('Database=D:\temp\test.fdb');
          Add('User_Name=SYSDBA');
          Add('Password=masterkey');
        end;

        try
          dm.FDConnection.Open;
        except
          // to-do: update error message
        end;
      end;

      procedure TMyThread.SetSwitch(value: Integer);
      begin
        Switch := value;
      end;
</code></pre>

<p>unit UnitDMFireBird;</p>

<pre><code>      TDMFireBird = class(TDataModule)
          FDConnection: TFDConnection;
          FDTransaction: TFDTransaction;
        private
          { Private declarations }
        public
          { Public declarations }
        end;
</code></pre>

<p>Test no.1
Code:</p>

<pre><code>    Source0.ThStart( 0 );
    // Source1.ThStart( 1 );
</code></pre>

<p>Result for Source0:        </p>

<pre><code>    14:46:20 Start
    14:46:20 Terminate
</code></pre>

<p>Result for Source1: no result</p>

<p>Comment: At the same time first connection was opened;</p>

<p>Test no.2
Code:</p>

<pre><code>    Source0.ThStart( 0 );
    Source1.ThStart( 1 );
</code></pre>

<p>Result for Source0:</p>

<pre><code>    14:48:16 Start
    14:48:40 Terminate
</code></pre>

<p>Result for Source1:</p>

<pre><code>    14:48:16 Start
    14:48:40 Terminate
</code></pre>

<p>Comment: Terminate for both at the same time.</p>

<p>My question. Why one blocked another ? Why (for test no.2) first correct connection wait for second unavailable connection? In test no.2 first connection should to open like in test no.1 -> fast, without wait.</p>