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

New connection to the server hangs [CORE6346] #6587

Closed
firebird-issue-importer opened this issue Jun 29, 2020 · 21 comments
Closed

New connection to the server hangs [CORE6346] #6587

firebird-issue-importer opened this issue Jun 29, 2020 · 21 comments

Comments

@firebird-issue-importer

Submitted by: Daniel Trubač (dant)

Attachments:
stack.zip

Votes: 1

Hello,

symptoms:
established connections are working without problem, but new connection hangs, tried from .net, ibeexpert.

Please mail me if you would like to have process dump.

Please let me know if there is anything else that i could provide to help with investigation of the issue.
When it happens again, is there anything that i could try to resolve such issue without killing the process?

Thank you
Best regards
Daniel Trubač

Commits: e23273d 1f67b03

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 29, 2020

Commented by: @hvlad

Is it reproducible ? If yes - please, provide steps to reproduce.
If you have dump - please share it with us, but we need also .pdb files of that snapshot build (33296), else dump is useless.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 29, 2020

Commented by: Daniel Trubač (dant)

i have sent download details to you by e-mail.

I do not know how to reproduce the issue.

Only thing that seems weird to me, is garbage collector and its transaction, which i noticed might be running for days, can that be related?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Virgo Pärna (virgo)

I think, that I might have had same issue (I downgraded test system back to 3.0.5). It is 32 bit version.

When I upgraded it to 3.0.6, then connecting to database became slow. I was especially bad, because we have software, that in startup checks all possible databases, it can have (current configuration was 36) by connecting them and then making queries to one internal table and RDB$DATABASE and MON$DATABASE.

With 3.0.5 it took 6 seconds (with only 1 database existing out of 36), but with 3.0.6 it took ages. It happened with release version (downloaded from homepage).

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: @hvlad

Stack trace

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Modified by: @hvlad

Attachment: stack.zip [ 13470 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: @hvlad

The issue is related with monitoring tables, accessed from ON CONNECT trigger.
While it is not very recommended to do - it is fully legal and should not freeze whole server.
We are looking for solution, please wait a bit.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: michalk1 (michalk1)

Not sure if it is related to this issue, but I also experence serious slowness in FB 3.0.6, when compared with 3.0.5. In my case, the affected operations are
1) large blob inserts, that periodically gets blocked at isc_put_segment calls
2) series of large ddl statements during database creation, that are also periodically blocked.

The blocks last for several minutes, during which there is no obvious server activity (minimum CPU/HDD/Network load), so it looks rather like a timeout. The process eventually resumes (no error message), but the problem repeates soon after (on another blob segment or ddl command).
Tested on Win 10 and virtual Ubuntu 20.04 (server side) with 64 bit FB 3.0.6, client app at Win 10.
Switching back to 3.0.5 solves the issue.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: @hvlad

michalk1,

if you have test case - feel free to create new ticket or describe issue in fb-devel if you not sure.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Virgo Pärna (virgo)

Ok, mine is also probably different issue, because there are not triggers. But having existing connection to database server is important fact. Wrote powershell script to test connecting databases and it stalls on connecting seventh database, that does not exist.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: michalk1 (michalk1)

I just found that my case has something to do with wire compression (I set WireCompression = true at client side). When I turn it off, 3.0.6 is back at full speed of 3.0.5. To reproduce the problem, it should be sufficient to insert a large file (say Firebird installation exe file) into any database binary blob field when wire compression is active. I'll probably open a new ticket for it.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Slavomir Skopalik (skopaliks)

The code that we do in ON CONNECTION trigger:

-- Get connection details
SELECT FIRST 1 MON$REMOTE_PROCESS, MON$REMOTE_ADDRESS FROM MON$ATTACHMENTS
WHERE MON$ATTACHMENT_ID=current_connection INTO :proc,:address;
-- Create record in ApplicationLog
BEGIN
INSERT INTO UserLogins (application,IP) VALUES (:proc,:address)
RETURNING id INTO :id;
WHEN ANY DO BEGIN END
END

May it will help you.

PS: Will be good, if there will be a way how to get connection details out of monitoring tables.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: @dyemanov

RDB$GET_CONTEXT('SYSTEM', 'CLIENT_PROCESS')
RDB$GET_CONTEXT('SYSTEM', 'CLIENT_ADDRESS')

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Slavomir Skopalik (skopaliks)

RDB$GET_CONTEXT('SYSTEM', 'CLIENT_PROCESS') is not defined in FB2.5 docs but works (on FB2.5).

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: @dyemanov

It was added to v2.5.3, see CORE3704.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Slavomir Skopalik (skopaliks)

You are right, but documentation for FB2.5.9 says:

SYSTEM namespace provides read-only access to the following variables.

Variable name Value
------------------------------------------------------------------------------
NETWORK_PROTOCOL | The network protocol used by client to connect. Currently
| used values: "TCPv4", "WNET", "XNET" and NULL
|
CLIENT_ADDRESS | The wire protocol address of remote client represented as
| string. Value is IP address in form "http://xxx.xxx.xxx.xxx" for
| TCPv4 protocol, local host name for XNET protocol and
| NULL for all other protocols
|
DB_NAME | Canonical name of current database. It is either alias
| name if connectivity via file names is not allowed or
| fully expanded database file name otherwise.
|
ISOLATION_LEVEL | Isolation level for current transaction. Returned values
| are "READ COMMITTED", "CONSISTENCY", "SNAPSHOT"
|
TRANSACTION_ID | Numeric ID for current transaction. Returned value is the
| same as of CURRENT_TRANSACTION pseudo-variable
|
SESSION_ID | Numeric ID for current session. Returned value is the
| same as of CURRENT_CONNECTION pseudo-variable
|
CURRENT_USER | Current user for the connection. Returned value is the
| same as of CURRENT_USER pseudo-variable
|
CURRENT_ROLE | Current role for the connection. Returned value is the
| same as of CURRENT_ROLE pseudo-variable
|
ENGINE_VERSION | Engine version number, e.g. "2.1.0" (since V2.1)

https://github.com/FirebirdSQL/firebird/blob/B2_5_Release/doc/sql.extensions/README.context_variables2

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 30, 2020

Commented by: Sean Leyne (seanleyne)

This ticket seems related to other connection issues reported related to 3.0.6 [CORE6346, CORE6347 and CORE6348]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 2, 2020

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 2, 2020

Commented by: @hvlad

The fix is committed into v3, please check next snapshot build

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 2, 2020

Commented by: @mrotteveel

@vlad will this also be ported to Firebird 4? Because I believe the problem occurs there as well.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 3, 2020

Commented by: @hvlad

Sure

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 9, 2020

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 RC 1 [ 10930 ]

Fix Version: 3.0.7 [ 10940 ]

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

Successfully merging a pull request may close this issue.

None yet
2 participants