It's almost impossible for me to minimize dozens of thousands of lines of codes, but I have new issue with threads (again only on one server noted above, no problems elsewhere)
the following code is exiting with approx. 100 times
An unhandled exception occurred at $000000000041740C :
EAccessViolation :
$000000000041740C
exception is not somewhere in the middle but when exiting application, all queries are fine, working.
The thing is, when I comment out
mt := TMyThread.Create(false);
no exception occures.
Only when I start thread, that error occures. As obvious, the thread actually does nothing.
program test;
uses cthreads, classes, sysutils, p3_mysql;
type
TMyThread = class(TThread)
public
constructor Create(aCreateSuspended: boolean);
procedure Execute; override;
end;
constructor TMyThread.Create(aCreateSuspended: boolean);
begin
FreeOnTerminate := true;
inherited Create(aCreateSuspended);
end;
procedure TMyThread.Execute;
begin
end;
var
fQuery: TP3MySql;
mt: TMyThread;
begin
fQuery := TP3MySql.create;
fQuery.Connect('10.50.1.2', 'user', 'password');
fQuery.ExecuteSQL('set names utf8', false);
mt := TMyThread.Create(false);
fQuery.ExecuteSql('SELECT * FROM `p2_userbilling`.`user` WHERE (`id` = %d)', [9], true);
fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`sms_user` WHERE (`id_user` = %d)', [9], true);
fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`sms_user` WHERE (`id_user` = %d)', [9], true);
fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`sms_user_forbidden_number` WHERE (`id_sms_user` = %d)', [1], true);
fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`sms_user_sender` WHERE (`id_sms_user` = %d)', [1], true);
// fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`sms_user_value` WHERE (`id_sms_user` = %d)', [1], true);
fQuery.ExecuteSql('SELECT * FROM `p2_sms`.`gateway_settings` WHERE (`id` = %d)', [5], true);
end.