FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

Firebird 5 hang after starting remote profiling session #8176

Closed livius2 closed 4 months ago

livius2 commented 4 months ago

Starting RDB$PROFILER.START_SESSION hangs server completely. It stops responding to requests and new connections.

  1. To reproduce the problem, run Flamerobin twice and connect to probably any database (but the same database for both instances).
  2. In the first Flamerobin instance, go to the system tables, right-click on e.g., RDB$FIELDS, choose "Browse data," and leave the window open.
  3. In the second Flamerobin instance, execute the following query (adjust 79 to the connection ID from the first Flamerobin instance).
SELECT RDB$PROFILER.START_SESSION('Profile without "DETAILED_REQUESTS"', NULL, 79)
FROM RDB$DATABASE;

I tried above session on current Firebird 5 snapshot on Windows (5.0.1.1432) 64bit, and the server hung completely. No new connections were allowed and current connections stopped responding.

hvlad commented 4 months ago

The more easy way to reproduce the issue. Use database that has never run profiler session before - the problem happens when profiler creates its metadata. Statements cache should be enabled (MaxStatementCacheSize <> 0)

  1. start 1st isql instance against test DB and run any query, I use select current_connection from rdb$database; as its result will be used in next step

  2. start 2nd isql instance against same DB and start profile session against attachment from 1st session: SELECT RDB$PROFILER.START_SESSION('Profile', NULL, <N>) FROM RDB$DATABASE; where is value from 1st session

Firebird is hung at this point.

hvlad commented 4 months ago

Check next snapshot build, please

pavel-zotov commented 4 months ago

... QA notes ...

  1. On CLASSIC problem still exists: firebird hangs, although new connections to test DB are allowed (found both on 5.x and 6.x). One may even to run 'delete from mon$attachments' (using new ISQL session) but there is no effect: server does not perform that. Because of this, test currently can be run only on Super.
  2. It looks weird that user (NON-sysdba) who has necessary rights to start profiling, must be explicitly granted to access PLG* tables/views.
pavel-zotov commented 4 months ago

PS. Link to FB 5.x and 6.x snapshots/dumps/traces when trying to run test under Classic: https://drive.google.com/drive/folders/1rKtdjjrKGXuqbyldxbXUKtKvuYz086g0?usp=sharing

hvlad commented 4 months ago

On CLASSIC problem still exists: firebird hangs

Could you test on Linux, please ? I suppose this is Windows-related and completely independent bug

pavel-zotov commented 4 months ago

Checked on Linux, 5.0.1.1439-c7d5566 and 6.0.0.395-845f483, ServerMode = Classic: all fine, FB does not hang. Used firebird.conf:

AuthServer = Srp, Win_Sspi, Legacy_Auth
BugCheckAbort = 1
ClearGTTAtRetaining = 0
ClientBatchBuffer = 131072
ConnectionIdleTimeout = 0
DefaultDBCachePages = 4K
ExtConnPoolLifeTime = 10
ExtConnPoolSize = 10
ExternalFileAccess = Full
InlineSortThreshold = 1000
IpcName = xnet_fb6x_cs
KeyHolderPlugin = fbSampleKeyHolder
MaxIdentifierByteLength = 252
MaxIdentifierCharLength = 63
MaxParallelWorkers = 8
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
ParallelWorkers = 1
ReadConsistency = 0
RemoteServicePort = 4700
ServerMode = Classic
SnapshotsMemSize = 64K
StatementTimeout = 300
TempCacheLimit = 128M
TempDirectories = /var/tmp/qa_2024b
TipCacheBlockSize = 4M
UseFileSystemCache = true
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4
hvlad commented 4 months ago

Reopened to fix more problems with profiler IPC

hvlad commented 4 months ago

Should be fixed now

livius2 commented 3 months ago

Check next snapshot build, please

It is ok now, thanks