Forum > Databases

[SOLVED] [IBX] Error, Project raised exception class 'External : SIGSEGV'

<< < (2/2)


--- Quote from: incendio on December 02, 2021, 07:58:04 am ---
--- Quote from: tonyw on December 01, 2021, 02:44:51 pm ---When you try to close a database, IBX will attempt to commit/rollback any open transactions. That will be where you are mostly likely to be getting an error. I have tried to duplicate your problem, but all I see is a Firebird exception when I stop the server - Close always gives the same exception (as expected) - and ForceClose works.

Somewhere there may be an unprotected call to a low level handle. If you could post the stack tree when you get a sigserv then this might help.

--- End quote ---
Sorry, new to Lazarus here. What is stack tree and how to get it?

I use the exact codes from this post :,57344.0.html

--- End quote ---
Sorry meant the "Call Stack". You find this on the View->Debug Windows menu. When an exception occurs, it shows you not just where the exception was raised but the call history so that you can determine how the problem came above. Example attached.

Here is the content of Call Stack :

#0 RELEASE(0x7ffff54daae8) at fbintf/client/3.0/firebird/Firebird.pas:3684
#1 FREEHANDLE(0x7ffff5aee480) at fbintf/client/3.0/FB30Transaction.pas:104
#2 ROLLBACK(0x7ffff5aee480, true) at fbintf/client/3.0/FB30Transaction.pas:200
#3 ENDTRANSACTION(0x7ffff622f720, TAROLLBACK, true) at runtime/nongui/IBDatabase.pas:1771
#4 BEFOREDATABASEDISCONNECT(0x7ffff622f720, 0x7ffff5a0a040) at runtime/nongui/IBDatabase.pas:1914
#5 INTERNALBEFORECLOSE(0x7ffff5a0a040) at runtime/nongui/IBDatabase.pas:733
#6 INTERNALCLOSE(0x7ffff5a0a040) at runtime/nongui/IBDatabase.pas:703
#7 DODISCONNECT(0x7ffff5a0a040) at runtime/nongui/IBDatabase.pas:531
#9 ?? at :0
#10 ?? at :0

Thanks for the above call stack. It's easy enough to see where the problem arises. On the face of it, this is a classic "double free" - of the transaction handle. The exception occurs in when IBX calls "release" to free the handle. If does so after a forced Rollback (see 2nd parameter on line 2).

Looking at the code, the handle is always protected and I would guess that the problem is that Firebird automatically freed the handle when the connection was lost. The simplest way of avoiding a problem is probably to ignore the exception by modifying the FreeHandle procedure to:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFB30Transaction.FreeHandle;begin  if assigned(FTransactionIntf) then  try    FTransactionIntf.release;  except {ignore}  end;  FTransactionIntf := nil;end;
This should be safe given that the exception occurs when you are trying to get rid of the handle anyway and on recovery from an exceptional condition. A final version of the fix will probably only ignore the exception when "Force" is true - but that requires more changes to the unit.

Thanks, that solved the problem.


[0] Message Index

[*] Previous page

Go to full version