[
http://tracker.firebirdsql.org/browse/CORE-3646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Peshkov reopened CORE-3646:
-------------------------------------
Fix Version/s: (was: 2.5.2)
Unfortunately linux (glibc) implementation of pthread_kill() function is
unstable and can segfault in case of invalid thread id. Better solution is
required here.
> Segmentation fault in FreePascal multi-threaded program when using 2.5.x
> client library on Linux
> ------------------------------------------------------------------------------------------------
>
> Key: CORE-3646
> URL: http://tracker.firebirdsql.org/browse/CORE-3646
> Project: Firebird Core
> Issue Type: Bug
> Components: API / Client Library
> Affects Versions: 2.5.0, 2.5.1
> Environment: OpenSuse 10.2 64 bits, Ubuntu 11.10 64-bits, FreePascal
> 2.2.5 x86_64, FreePascal 2.4.5 x86_64, Firebird 2.5.0, Firebird 2.5.1
> Reporter: Pumuqui
> Assignee: Alexander Peshkov
>
> Segmentation fault for a FreePascal program,
> that connects to a FB 2.5 database inside a thread.
> The segmentation fault just occurs, when there is a
> Firebird exception caught inside the thread.
> The example code below should illustrate the situation.
> There are no problems on Windows, nor on Linux when using
> a 2.1 client library, the fault just happens for Linux and the 2.5 client.
> I posted the error first on the fpc-devel list, where they told me that
> this should be an error in the Firebird client dll:
> http://www.mail-archive.com/[email protected]/msg24051.html
> Change the connection string in the following code, so that it points
> to an existing database, then put the code into file fbthreadtest.lpr and
> compile with
> <code>
> fpc -gl -dUseCThreads -ofbthreadtest fbthreadtest.lpr
> <code>
> Run with
> <code>
> foo@PSERVER:~/Development/src$./fbthreadtest
> select...
> ...exception
> Violación de segmento
> </code>
> This is the example program:
> <code>
> program fbthreadtest;
> {$IFDEF FPC}
> {$MODE DELPHI}{$H+}
> {$ENDIF}
> {$APPTYPE CONSOLE}
> {$LINKLIB pthread}
> uses
> {$IFDEF UNIX}
> cthreads,
> cwstring,
> {$ENDIF}
> Classes,
> IBConnection, sqldb;
> type
> TFBThread = class(TThread)
> private
> protected
> procedure Execute; override;
> public
> constructor Create;
> end;
> constructor TFBThread.Create;
> begin
> inherited Create(True);
> FreeOnTerminate := False;
> Resume;
> end;
> procedure TFBThread.Execute;
> var
> db: TIBConnection;
> tr: TSQLTransaction;
> q: TSQLQuery;
> begin
> db := TIBConnection.Create(nil);
> try
> db.DatabaseName := 'localhost:/home/data/Database/ssstst.gdb';
> db.LoginPrompt := False;
> db.HostName := '';
> db.UserName := 'SYSDBA';
> db.Password := 'masterkey';
> db.Connected := TRUE;
> tr := TSQLTransaction.Create(nil);
> try
> tr.DataBase := db;
> tr.Action := caCommit;
> tr.Params.Clear;
> tr.Params.Add('isc_tpb_read_committed');
> tr.Params.Add('isc_tpb_rec_version');
> tr.Params.Add('isc_tpb_nowait');
> db.Transaction := tr;
> tr.Active := True;
> q := TSQLQuery.Create(nil);
> try
> q.Database := db;
> q.Transaction := tr;
> try
> Writeln('select...');
> // the following line raises an exception because rdb$databases
> doesn't exist.
> q.SQL.Text := 'select count(*) from rdb$databases';
> q.Prepare;
> except
> Writeln('...exception');
> end;
> finally
> q.Free;
> end;
> finally
> tr.Commit;
> tr.Free;
> end;
> finally
> db.Connected := False;
> db.Free;
> end;
> end;
> begin
> with TFBThread.Create do begin
> WaitFor;
> Free;
> end;
> end.
> </code>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel