Skip to content
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

Memory leak in FB 3.0 under brute-force attack [CORE4643] #4957

Open
firebird-automations opened this issue Dec 19, 2014 · 4 comments
Open

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Attachments:
fb30-memory-usage-under-bfa.zip

LI-T6.3.0.31474 Firebird 3.0 Beta 2

Batch for opening N windows with ISQLs, each generates random pair {login, password} and tries to connect:

----- brute-force.bat -----
@echo off
@cls

setlocal enabledelayedexpansion enableextensions

set winq=%1
@Rem default number of windows:
if .%1.==.. set winq=10

@Rem Replace with your own:

@Rem where FB console utilities are:
set fbc=C:\1INSTALL\FB30SNAP

@Rem Settings for connect:
set host=192.168.0.220
set port=3333
set dbnm=oltp30

set sql=tmp-brute-force.sql
@Rem Dummy command for isql immediately quit when login fails:
echo set list on; select * from mon$database;>%sql%

for /l %%i in (1, 1, %winq%) do (
start /min brute-force-worker.bat %%i %fbc% %host% %port% %dbnm% %sql%
)
----- end of brute-force.bat -----

Worker batch that launches single ISQL (NB: env. variable %TEMP% has to be defined):
----- brute-force-worker.bat -----
@echo off
set sn=%1
set fbc=%2
set host=%3
set port=%4
set dbnm=%5
set sql=%6
set logdir=%temp%\hack30
md %logdir% 2>nul
set /a k=1000+%sn
set log=%logdir%\hack_%k:~1,3%.log
del %log% 2>nul
:m1
echo window #⁠ %sn%
echo #⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
echo.>>%log%
set usr=%random%
set pwd=%random%
echo %time% before attempt to hack with usr=%usr% and pwd=%pwd%>>%log%
@echo on
%fbc%\isql %host%/%port%:%dbnm% -i %sql% -user %usr% -pas %pwd% 2>>%log% 1>>&2
@echo off
echo after attempt to hack: %time%>>%log%
goto m1
----- end of brute-force-worker.bat -----

Test:

brute-force.bat 150

Shell sctipt running on Linux for getting memory consumption of process 'firebird' (subdirectory 'logs' has to be exist):

$ cat fb_memo_watch.sh
fbn=firebird
log=./logs/$fbn.memo_usage.$(date +'%y%m%d_%H%M%S').log
rm -f $log
relax=5
while :
do
supertee -a -n $log echo $(date +'%y%m%d_%H%M%S') $(pmap -d $(pgrep $fbn)|tail -1)
sleep $relax
done

After brute-force.bat running several hours one may see that memory usage grows - see in attach files 'firebird-*.memo_usage*.log'.
I've run this test both on Release and Debug builds. The latter creates special debugu file 'memdebug' - it's also in attach.

PS. There is NO such problem on LI-V6.3.4.26821 Firebird 2.5.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: fb30-memory-usage-under-bfa.zip [ 12653 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Could you please use the actual Firebird version numbers, and not the 'legacy' version numbers reported for Interbase compatibility

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Mark,

where do you see 'actual' and 'legacy' version numbers ?

I run isql from FB folder (i.e. on server), connect to database and get:

SQL> show version;
ISQL Version: LI-T3.0.0.31474 Firebird 3.0 Beta 2
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-T3.0.0.31474 Firebird 3.0 Beta 2"
Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-T3.0.0.31474 Firebird 3.0 Beta 2/tcp (oel64)/P13"
Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-T3.0.0.31474 Firebird 3.0 Beta 2/tcp (oel64)/P13"
on disk structure version 12.0

Which kind of version number does ISQL report ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants