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 at server, when client select computed field, which used COALESCE or CAST [CORE6370] #6609

Closed
firebird-automations opened this issue Jul 24, 2020 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Jaromír Krys (fous)

I have table with 350 rows - random text:
CREATE TABLE TAB1
(
A1 Varchar(99),
A2 Varchar(199)
);
ALTER TABLE TAB1 ADD A3 COMPUTED BY (coalesce(a1, '')||'-'||coalesce(a2, ''));
and file try.sql:
SELECT a3 FROM tab1;
SELECT a3 FROM tab1;
... 5000 times
SELECT a3 FROM tab1;
I run command:
"c:\Program Files\Firebird\Firebird_3_0\isql.exe" -u SYSDBA -p 1 -i c:\1\try.sql -o c:\1\result.txt "localhost/3051:c:\fdb\try.fdb"
Then, if I observe the firebird server in the task manager, it gradually consumes more and more memory.
However, if I select column a1 (ie uncounted) instead of a3, then the memory consumption does not increase. Also, if the computed would not use coalesce, the consumed memory does not increase (or the consumption increases much more slowly - I'm not sure).
If I use a 2.5.8 server, the memory consumption also does not increase.
commit and new transaction - no change
disconnect and connect - memory is freed

Commits: dde597e

@firebird-automations
Copy link
Collaborator Author

Commented by: @cincuranet

I tested this on 3.0.5 x64 and I can confirm it as well.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

The leak happens even without data in the table?

@firebird-automations
Copy link
Collaborator Author

Commented by: Jaromír Krys (fous)

Yes, leak happens with empty table and 30 000 rows in try.sql

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Thanks for the test case. Actually it's CAST that was leaking and COALESCE uses CAST internally.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

summary: Memory leak at server, when client select computed field, which used coalesce function => Memory leak at server, when client select computed field, which used COALESCE or CAST

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.7 [ 10940 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Please test in the next v3 snapshot.

@firebird-automations
Copy link
Collaborator Author

Commented by: Jaromír Krys (fous)

Tested by try.sql - OK - many thanks
In real database - will be tested - not in snapshot

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

3 participants