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

Resources (e.g. sort files) owned by trigger may not be released when it's interrupted asynchronously [CORE4334] #4657

Closed
firebird-issue-importer opened this issue Feb 5, 2014 · 10 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Feb 5, 2014

Submitted by: @pavel-zotov

Attachments:
fb_sort_files_remain_opened_-_test_case.zip

Reproduced on:
LI-T3.0.0.30872
WI-T3.0.0.30855

firebird.conf changes: TempCacheLimit = 64K

DDL: see attach, file CROSS.DDL.
#⁠#⁠#⁠#⁠

Please note that this script contains on-commit trigger with some kind of 'heavy' query to MON$-tables:
-- first check uncommitted data in all other transactions:
if (
exists(
with c as(
select
c.mon$transaction_id tid
--,substring(c.mon$variable_name from 3) vn
,cast( substring(c.mon$variable_name from 3) as varchar(16384)) vn
,min(cast( iif( c.mon$variable_name starting with 'ID_NEW', c.mon$variable_value, null) as int) ) ctx_id_new
,min(cast( iif( c.mon$variable_name starting with 'F1_NEW', c.mon$variable_value, null) as int) ) ctx_f1_new
,min(cast( iif( c.mon$variable_name starting with 'F2_NEW', c.mon$variable_value, null) as int) ) ctx_f2_new
from mon$context_variables c
group by 1,2 -- <<<<<<<<<<<<<<<<<< THIS WILL CAUSE 'SORT' in PLAN <<<<<<<<<<
)
select *
from c ca join c cb
on ca.ctx_id_new<>cb.ctx_id_new
and sign(ca.ctx_f1_new - cb.ctx_f2_new) * sign(cb.ctx_f1_new - ca.ctx_f2_new)>0
) -- exists
)
then
exception ex_crossed_dirty;

Also, note that one of field of that query is deliberately casted to long string (16384 chars).

Test:
1) open *single* isql session that runs script CROSS.SQL - see in attach.
2) wait about 10-15 seconds and than kill that session, e.g. via PSKILL utility (from Sysinternals package).

Result: FB keeps one or two FB_SORT_*-files open infinite time untill restart.

Commits: 462cd99 FirebirdSQL/fbt-repository@c611611

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Modified by: @pavel-zotov

Attachment: fb_sort_files_remain_opened_-_test_case.zip [ 12420 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Commented by: @pavel-zotov

PS.
Beside fb_sort_* another temp files appears in temp-folder, namely: fb_recbuf and fb_blob. These are removed always OK.
fb_sort-files remains opened ONLY if we kill isql and will be removed if script will finished without interruption.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Modified by: @dyemanov

Version: 3.0 Alpha 1 [ 10331 ]

Version: 3.0 Alpha 2 [ 10560 ]

summary: fb_sort_* files remain opened after forcely detach connect when low value of TempCacheLimit and big size of sorting data => Resources (e.g. sort files) owned by trigger are not released when it's interrupted asynchronously

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Modified by: @dyemanov

summary: Resources (e.g. sort files) owned by trigger are not released when it's interrupted asynchronously => Resources (e.g. sort files) owned by trigger may not be released when it's interrupted asynchronously

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 5, 2014

Commented by: @dyemanov

I expect it to be fixed now, please verify.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 6, 2014

Commented by: @pavel-zotov

Checked (LI-T3.0.0.30876), result: fixed OK, no files remains in temp folder.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Feb 6, 2014

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 3, 2015

Modified by: @pavel-zotov

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

QA Status: Cannot be tested

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 22, 2015

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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