Call to Services API on 1st FB instance blocks start of audit session in 2nd FB 
instance for 130 seconds
--------------------------------------------------------------------------------------------------------

                 Key: CORE-6476
                 URL: http://tracker.firebirdsql.org/browse/CORE-6476
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 4.0 Beta 2
            Reporter: Pavel Zotov


Weird behaviour was encountered during attempts to implement test for CORE-5993.
Steps to reproduce:

* create two folders for FB instances (in the commands list below these are: 
"C:\FB\40SS\" and "C:\FB\fb40-tmp\");

* put (unpack) entire FB distributive to each of these folders;

* open firebird.conf in each of them and set different ports for listening 
(e.g. 3400 and 57456 )

* STOP any running FB servers

* add to firebird.conf in the 2nd FB instance (which is in "C:\FB\fb40-tmp\") 
line for audit:
=====
AuditTraceConfigFile = "C:\FBTESTING\qa\fbt-repo\tmp\tmp_c5993_audit.cfg"
=====

* create config for audit (file 
"C:\FBTESTING\qa\fbt-repo\tmp\tmp_c5993_audit.cfg"):
=====
database=
{
    enabled = true
    log_filename = "C:\\FBTESTING\\qa\\fbt-repo\\tmp\\tmp_c5993_audit.log"
    time_threshold = 0
    log_initfini   = false
    log_warnings = false
    log_errors = true
    log_connections = true
    log_transactions = true
    log_statement_finish = true
}
=====

* Create batch with following content:
=====
@echo off
@setlocal enabledelayedexpansion enableextensions

@rem ########
set DELAY=130
@rem ########

set log=%~dpn0.tmp

taskkill /f /t /im firebird.exe

tasklist | findstr /i /c:"firebird.exe" >nul
if NOT errorlevel 1 (
    echo At least one running FB instance detected. You have to stop all of 
them.
    goto :fin
)

@echo on

start C:\FB\40SS\firebird.exe -a
start C:\FB\fb40-tmp\firebird.exe -a

ping -n 2 127.0.0.1>nul

@echo !time! Call services API of the first FB instance. Check result:
C:\FB\40SS\fbsvcmgr.exe localhost/3400:service_mgr user sysdba password 
masterkey info_user_dbpath

@echo Take delay for !delay! seconds.
timeout !DELAY!

@echo !time! Check that active session exists in the TRACE list of the second 
FB instance:
C:\FB\fb40-tmp\fbsvcmgr.exe localhost/57456:service_mgr user sysdba password 
masterkey action_trace_list 1>!log!
@rem C:\FB\fb40-tmp\fbsvcmgr.exe localhost/57456:service_mgr user sysdba 
password masterkey info_user_dbpath 1>!log!
@echo off

for /f %%a in ("!log!") do (
    if %%~za EQU 0 (
        echo ####### ACHTUNG #######
        echo NO TRACE SESSIONS FOUND
        echo #######################
    ) else (
        type !log!
    )
)

del !log!
taskkill /f /t /im firebird.exe

:fin
echo Bye-bye.
=====

PAY ATTENTION on variable DELAY. Now it is 130.

Run this batch.
Its output will be:
=====
C:\FBTESTING\qa\misc>start C:\FB\40SS\firebird.exe -a

C:\FBTESTING\qa\misc>start C:\FB\fb40-tmp\firebird.exe -a

C:\FBTESTING\qa\misc>ping -n 2 127.0.0.1 1>nul
12:21:39.56 Call services API of the first FB instance. Check result:

C:\FBTESTING\qa\misc>C:\FB\40SS\fbsvcmgr.exe localhost/3400:service_mgr user 
sysdba password masterkey info_user_dbpath
Security database: C:\FB\40SS\SECURITY4.FDB
Take delay for 130 seconds.

C:\FBTESTING\qa\misc>timeout !DELAY!

Waiting for   0 seconds, press a key to continue ...
12:23:50.13 Check that active session exists in the TRACE list of the second FB 
instance:

C:\FBTESTING\qa\misc>C:\FB\fb40-tmp\fbsvcmgr.exe localhost/57456:service_mgr 
user sysdba password masterkey action_trace_list  1>!log!

Session ID: 1
  name:  Firebird Audit
  user:  SYSDBA
  date:  2021-01-28 12:23:50
  flags: active, admin, system, audit
SUCCESS: The process with PID 2652 (child process of PID 2800) has been 
terminated.
SUCCESS: The process with PID 6292 (child process of PID 2800) has been 
terminated.
Bye-bye.
=====

So far, so good: we can see audit session in the trace list.

Now change DELAY variable to 129.

Output will be finished like this:
=====
####### ACHTUNG #######
NO TRACE SESSIONS FOUND
#######################
SUCCESS: The process with PID 6780 (child process of PID 5952) has been 
terminated.
SUCCESS: The process with PID 6932 (child process of PID 5952) has been 
terminated.
Bye-bye.
=====

PS. Checked on 4.0.0.2345 SS

Config file for 1st FB:
=====
AuthClient = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
AuthServer = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
BugCheckAbort = 1
DefaultDbCachePages = 20000
ExtConnPoolLifeTime = 10
ExtConnPoolSize = 10
ExternalFileAccess = Full
FileSystemCacheThreshold = 65536K
IpcName = fb40_SS
KeyHolderPlugin = KeyHolder
LockHashSlots = 22111
LockMemSize = 5M
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
ReadConsistency = 0
RemoteServicePort = 3400
ServerMode = Super
TempBlockSize = 2M
TempCacheLimit = 2147483647
TempDirectories = d:\temp
UDFAccess = Restrict UDF
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4
=====

Config file for 2nd FB:
=====
AuditTraceConfigFile = "C:\FBTESTING\qa\fbt-repo\tmp\tmp_c5993_audit.cfg"
AuthClient = Srp
AuthServer = Srp
BugcheckAbort = 1
IpcName = tmp_ipc_5993
RemoteServiceName = tmp_fbs_5993
RemoteServicePort = 57456
ServerMode = Super
WireCrypt = Required
=====

-- 
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

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to