Hi,
I have a DataModule with a UniConnection and a UniQuery. This DataModule is created by several threads (6) for updating / inserting data into postgres and works like a charm. The Datamodules are created by the thread in the .execute method.
I decided to add an UniAlerter on the DataModule. I just put it without any code and then when I fire up the application, 1 out of 4 times I get an access violation. The debugger stops at System.Classes method Threadproc (try Thread.execute) during startup of the application.
The callstack is at TPgSQLnotificationsThread.execute
I noticed that I have the UniConnection connected at designtime.
When I set connected = false (designtime) the access violation does not occur.
Anybody else had this issue ? I think it is a thread management bug inside the UniAlerter component.
I am using version Unidac 6.4.16 in Delphi XE5 ; Postgres 9.5.5
regards,
Pascal
Access violation when using UniAlerter
Re: Access violation when using UniAlerter
To use TUniAlerter in a multithreaded application the TUniAlerter.Start method should be executed in the main application thread, for example by using the Synchronize method:
Code: Select all
Synchronize(UniAlerter1.Start);
Re: Access violation when using UniAlerter
How can a UniAlerter be used in a seperate thread without Synchronize?
Especially for sending and receiving database events. In the receiving event an UniQuery using the same UniConnection as the UniAlerter is used. That means the UniAlerter.OnEvent have to run in the same thread and not in the main application thread. I noticed that UniAlerter.OnEvent is fired in the main application thread and not in the expected thread.
Especially for sending and receiving database events. In the receiving event an UniQuery using the same UniConnection as the UniAlerter is used. That means the UniAlerter.OnEvent have to run in the same thread and not in the main application thread. I noticed that UniAlerter.OnEvent is fired in the main application thread and not in the expected thread.
Re: Access violation when using UniAlerter
The TUniAlerter.OnEvent call using the Synchronize method is implementation specificity in UniDAC.
However, you can leave your suggestion about implementing alert mechanism in UniDAC without using the Synchronize method at our UserVoice ( http://devart.uservoice.com/forums/1046 ... components ). If the suggestion gets enough votes, we will consider the possibility of its implementation.
However, you can leave your suggestion about implementing alert mechanism in UniDAC without using the Synchronize method at our UserVoice ( http://devart.uservoice.com/forums/1046 ... components ). If the suggestion gets enough votes, we will consider the possibility of its implementation.