SIGINT raises an exception in IBConnection.Close lazarus / 16-Databases ---------------------------------------------------------------------- Sann-X! · 2018-11-01 12:12 Hi, I have created simple project included IBConnection and Button components. Also I reassigned SigAction handler. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, Unit1, BaseUnix; {$R *.res} procedure DoSig(signal: longint; info: psiginfo; context: psigcontext); cdecl;begin  if Assigned(Application) then      Application.Terminate;end; procedure SetSigHandler(const Sig: cint; const new, old: PSigActionRec; const Handler: SigActionHandler);begin  new^.sa_handler := Handler;  fillchar(new^.Sa_Mask, SizeOf(new^.sa_mask), #0);  new^.sa_flags := 0;  {$ifdef Linux}               // Linux specific  new^.Sa_Restorer := nil;  {$endif}  fpSigAction(Sig, new, old);end; var  new_act_term, new_act_int, new_act_hup, old_act: SigActionRec;begin  SetSigHandler(SIGTERM, @new_act_term, @old_act, @DoSig);  SetSigHandler(SIGINT, @new_act_int, @old_act, @DoSig);  SetSigHandler(SIGHUP, @new_act_hup, @old_act, @DoSig);   {$if declared(UseHeapTrace)}  GlobalSkipIfNoLeaks := True; // supported as of debugger version 3.1.1  {$endif}   RequireDerivedFormResource := True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.Run;end.  Success scenario: Run appClick button that open fb connectionClose app Failed scenario: Run appClick button that open fb connectionIn terminal execute command "kill -SIGINT "Last step raises exception like as attached image. How to fix it? DB: Firebird classic 2.5 Device: OrangePi Zero OS: ARMBIAN 5.35 user-built Ubuntu 16.04.3 LTS 3.4.113-sun8i ---------------------------------------------------------------------- Sann-X! · 2018-11-01 12:13 Test project sources ---------------------------------------------------------------------- sash · 2018-11-01 22:08 Why do you ever need to kill your application from outside? If you don't like "how it is dying", use try..except. ---------------------------------------------------------------------- Sann-X! · 2018-11-02 06:50 Quote from: sash on November 01, 2018, 11:08:46 pmWhy do you ever need to kill your application from outside? See here Quote from: sash on November 01, 2018, 11:08:46 pmIf you don't like "how it is dying", use try..except. Try..except don't help. I suppose that stack is corrupted. But why? I don't know. ---------------------------------------------------------------------- DonAlfredo · 2018-11-02 08:53 I am trying to run your program on Linux Mint. But Mint latest has FB 3.0.2. I have patched FPC to work with this version, but your employee-file is not accepted by 3.0.2 (wrong version). If you can help me get things running, I can try to help you with your sig-problem. ---------------------------------------------------------------------- Sann-X! · 2018-11-02 09:09 Quote from: DonAlfredo on November 02, 2018, 09:53:23 amBut Mint latest has FB 3.0.2. ..If you can help me get things running.. I can't. My OS device supports Firebird 2.5 only. ---------------------------------------------------------------------- Sann-X! · 2018-11-02 11:00 Quote from: DonAlfredo on November 02, 2018, 09:53:23 amI am trying to run your program on Linux Mint. But Mint latest has FB 3.0.2. You can install fb2.5 manually. See here. After this do following: cp /opt/firebird/misc/firebird.init.d.debian /etc/init.d/firebird2.5chmod +x /etc/init.d/firebird2.5update-rc.d firebird2.5 defaultssudo /etc/init.d/firebird2.5 reload ---------------------------------------------------------------------- sash · 2018-11-02 11:34 Quote from: Sann-X! on November 02, 2018, 10:09:03 amI can't. My OS device supports Firebird 2.5 only. There's virtualbox, vmware. You can install any linux there, and test if problem is specific for arm architecture or not. ---------------------------------------------------------------------- DonAlfredo · 2018-11-02 11:39 I would appreciate if you can design an app that does not depend on a pre-loaded database file. So, something that starts empty and creates an entry on startup or something similar. ---------------------------------------------------------------------- Sann-X! · 2018-11-02 12:02 I posted similar question on other forum (ru lang). FB developers say that fbclient set its SIG* handler in other thread. Workaround is set my own SIG* handler AFTER firebird unit/library initialization. ---------------------------------------------------------------------- sash · 2018-11-02 12:35 My own test: - Ubuntu 18.04 bionic Kernel: x86_64 Linux 4.15.0-38-generic - FB3 - Simple default Application compiled with cthreads enabled, without any termination handlers.   Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   {$IFDEF UNIX}    cthreads,    {$ENDIF}  - Functionality: connect to database and open select query (and stay connected) on button click. Result:   Is being killed  by SIGINT or SIGTERM without any messages, just as it should be. ---------------------------------------------------------------------- Sann-X! · 2018-11-02 15:01 Quote from: sash on November 02, 2018, 01:35:51 pmMy own test: - Ubuntu 18.04 bionic Kernel: x86_64 Linux 4.15.0-38-generic - FB3 - Simple default Application compiled with cthreads enabled, without any termination handlers.   Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   {$IFDEF UNIX}    cthreads,    {$ENDIF}  - Functionality: connect to database and open select query (and stay connected) on button click. Result:   Is being killed  by SIGINT or SIGTERM without any messages, just as it should be. If you can, please try another minimal program for test from here (first message under spoiler). ---------------------------------------------------------------------- sash · 2018-11-02 22:41 Quote from: Sann-X! on November 02, 2018, 04:01:09 pmIf you can, please try another minimal program for test from here (first message under spoiler). project1.lpr(130,18) Error: Illegal expression ---------------------------------------------------------------------- Sann-X! · 2018-11-03 05:04 Quote from: sash on November 02, 2018, 11:41:12 pmproject1.lpr(130,18) Error: Illegal expression Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  OS_USER_NAME = ;You have to specify a username for a valid path to the EMPLOYEE.FDB file. This file is attached to the archive in the second post of this topic.