El 6/5/26 a les 12:02, michael via fpc-pascal ha escrit:

Thank you, no, that's not the problem (each thread uses its own connection), see my other reply.

Bye


Are you using 1 connection per thread ? If not, then that may be your problem.

Michael.

On 2026-05-06 10:55, Luca Olivetti via fpc-pascal wrote:
Hello,

I encountered a strange problem in an application, that's been running for over a year now. The application is quite convoluted with hundred of threads, one (actually more than one) of those threads connects to an ms sql server and now it blocks inside TMSSQLConnection.Execute, but not always


procedure TMSSQLConnection.Execute(const cmd: string);
begin
  DBErrorStr:='';
  DBMsgStr  :='';
  CheckError( dbcmd(FDBProc, PAnsiChar(cmd)) );
  CheckError( dbsqlexec(FDBProc) );  <--- this doesn't return
  CheckError( dbresults(FDBProc) );
end;


However when I terminate the application and before the destroy method of the thread is called, dbsqlexec returns and the rest of the thread goes on as nothing happened.

As an experiment I wrapped the method in synchronize but that only freezes the gui when it happens.

I don't know it if is relevant but I have a note in my program that I have to initialize the sql server libraries in the main thread, otherwise doing it in another thread eventually causes a sigsev.

I got the dlls (almost 2 years ago) following the instructions here

https://forum.lazarus.freepascal.org/index.php/ topic,55037.msg409167.html#msg409167

using Environment: PLAT=Win32, WIDTH=32, VS_VERSION=2017, TDSVER=7.3
(though older artifacts are deleted after a month)

This is on windows 32 bits, fpc 3.2.2, any hint on how to debug it further?

Bye
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to