Exception on connecting two UniAlerters

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Yves
Posts: 19
Joined: Thu 10 Mar 2016 08:01

Exception on connecting two UniAlerters

Post by Yves » Mon 11 Sep 2017 09:26

When two TUniAlerters are connected an Exception is raised. 'access violation at 0x0040a382: write of address 0x0000000c'. It happens not every time but very often.

I've made a test application. Very easy to reproduce. Change your database properties in main.pas and press the button.

The exception in the test application below can be avoided by connecting the second UniAlerter some time later by the use of a timer. Unfortunately this is not possible in our main application where we need two TUniAlerters that needs to be connected at the same time.

Devart Universal Data Access Components Version 7.0.2

Do I something wrong?

main.pas:

Code: Select all

unit Main;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DAAlerter, UniAlerter, Data.DB,
  DBAccess, Uni, Vcl.StdCtrls, UniProvider, PostgreSQLUniProvider;

type
  TForm1 = class(TForm)
    UniConnection1: TUniConnection;
    UniAlerter1: TUniAlerter;
    UniAlerter2: TUniAlerter;
    Button1: TButton;
    PostgreSQLUniProvider1: TPostgreSQLUniProvider;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  UniConnection1.Server   := 'localhost';
  UniConnection1.Port     := 5432;
  UniConnection1.Database := 'YourDatabase';
  UniConnection1.Username := 'YourUserName';
  UniConnection1.Password := 'YourPassword';
  UniConnection1.Connect;
  UniAlerter1.Active := True;
  UniAlerter2.Active := True;
end;

end.
main.dfm :

Code: Select all

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 281
  ClientWidth = 418
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 8
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end
  object UniConnection1: TUniConnection
    ProviderName = 'PostgreSQL'
    Left = 136
    Top = 16
  end
  object UniAlerter1: TUniAlerter
    Connection = UniConnection1
    Events = 'Tom'
    Left = 216
    Top = 16
  end
  object UniAlerter2: TUniAlerter
    Connection = UniConnection1
    Events = 'Jerry'
    Left = 296
    Top = 16
  end
  object PostgreSQLUniProvider1: TPostgreSQLUniProvider
    Left = 40
    Top = 80
  end
end

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Exception on connecting two UniAlerters

Post by azyk » Mon 11 Sep 2017 11:52

We composed the test project using the provided code parts, however the specified issue was not reproduced. Please send us a test project, where it is reproduced (use the contact form at our site http://www.devart.com/company/contactform.html ).

In addition, specify the exact version, which you are using:
- PostgreSQL
- RAD Studio

Yves
Posts: 19
Joined: Thu 10 Mar 2016 08:01

Re: Exception on connecting two UniAlerters

Post by Yves » Mon 11 Sep 2017 12:33

I've tried to use the contact form but it results in an error "Sorry, there was an error : unauthorized_client" while I'm logged in.

Anyway I've used WeTransfer instead. You can download my test application and sources in a *.zip from https://we.tl/0OLZKmSaX6. I assume it's available for a week.

Further:
- PostgreSQL 9.6.
- Embarcadero® RAD Studio Delphi 10.1 Berlin
The compiled executable is located in Win32\Debug\ProjectDevart.exe
See also the screenshot of the call stack in the *.zip file.
It goes not always wrong, but very often. So, please try several times. I think it's a timing / thread problem.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Exception on connecting two UniAlerters

Post by azyk » Wed 27 Sep 2017 09:55

We received your project, however, the specified issue was not reproduced in our environment. For its investigation, we need the issue to be stably reproduced. Please try to achieve its stable reproducing in your environment and then send us a project/steps to reproduce it.

Post Reply