New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedded server crashing on short connects to database which want to be sweeped [CORE6338] #6579
Comments
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: @artyom-smirnov Looks like libEngine unloaded too early. During debugging gdb shows such error some steps before crash: Temporarily disabling breakpoints for unloaded shared library "...../gen/Debug/firebird/plugins/libEngine12.so" |
Commented by: @artyom-smirnov Also breakpointing on dlclose and then stepping reveals that dlclose called for modules, then engine crashed. |
Commented by: @AlexPeshkoff Looks like I have an idea why this happens, next step is to fix segfault. |
Modified by: @artyom-smirnovVersion: 4.0 RC 1 [ 10930 ] |
Commented by: @artyom-smirnov CryptoManager affected similar issue: When CM thread starting it assigns its internal attachment flag "ATT_crypt_thread", but on short connection this attachment and shutdown racing and flag may be never assigned therefore attachment and CM thread can not properly stopped causing server hang. Reproducing: #!/bin/bash echo Auto = y > plugins/DbCrypt_example.conf rm tmp.fdb while true; do |
Commented by: @AlexPeshkoff Confirm, reproduced for crypt thread |
Modified by: @AlexPeshkoff |
Modified by: @AlexPeshkoff |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @artyom-smirnov
Is related to CORE6360
Duplicates CORE5197
In some cases firebird server can craft such database, which crashes embedded server if embedded connection too short to complete sweep.
To reproduce stop firebird, make sure running user will have all permissions to work as embedded and run included script.
Script will emulate database crafting by disabling sweep, inserting data but nor commit nor rollback it and enabling sweep. Next connections CAN crash, but not always. If crafted database will be properly sweeped crashes disappearing.
Stacktraces telling it crashing during exit, but stack with segfault smashed.
Reproducing script:
https://gist.github.com/artyom-smirnov/9f7f3d873f34fc12dcd721cab92818e3
or
#!/bin/bash
rm -f repro.fdb f
ISQL=bin/isql
GFIX=bin/gfix
cat << EOF > create.sql
create database 'repro.fdb';
create table test(test varchar(255));
EOF
cat << EOF > connect.sql
connect 'repro.fdb' user 'sysdba' password 'masterkey';
exit;
EOF
cat << EOF > gdbinit
set \$_exitcode = -1
run
if \$_exitcode != -1
quit
end
EOF
$ISQL -u sysdba -p masterkey -i create.sql
$GFIX -user sysdba -pass masterkey -h 0 repro.fdb
mkfifo f
cat f | $ISQL -u sysdba -p masterkey repro.fdb&
ISQL_PID=$!
exec 3>f
for i in `seq 1 1000`; do
cat << EOF > f
insert into test values('text');
EOF
done
kill -KILL $ISQL_PID
$GFIX -user sysdba -pass masterkey -h 1 repro.fdb
while true; do gdb -x gdbinit --args $ISQL -u sysdba -p masterkey -i connect.sql; done
#while true; do $ISQL -u sysdba -p masterkey -i connect.sql; done
Stack with crash looks smashed:
Thread 6 "isql" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffebfff700 (LWP 90529)]
0x00007ffff53bfd72 in ?? ()
(gdb) bt
#0 0x00007ffff53bfd72 in ?? ()
#1 0x0000000000000010 in ?? ()
#2 0x00007ffff7bc6340 in ?? ()
#3 0x00000000ebffecb0 in ?? ()
#4 0x00007ffff58e60e2 in ?? ()
#5 0x0000000000000001 in ?? ()
#6 0x0000000014000218 in ?? ()
#7 0x0000000000000000 in ?? ()
(gdb)
The text was updated successfully, but these errors were encountered: