Skip to content

Add manual delete for tra_dbcreators_list#8207

Merged
AlexPeshkoff merged 2 commits intoFirebirdSQL:masterfrom
TreeHunter9:master_delete_dbcreators_list
Aug 6, 2024
Merged

Add manual delete for tra_dbcreators_list#8207
AlexPeshkoff merged 2 commits intoFirebirdSQL:masterfrom
TreeHunter9:master_delete_dbcreators_list

Conversation

@TreeHunter9
Copy link
Copy Markdown
Contributor

@TreeHunter9 TreeHunter9 commented Aug 6, 2024

I found that if we try to write a lot of records to RecordBuffer (>MIN_TEMP_BLOCK_SIZE) we start increasing m_tempCacheUsage. When we don't need RecordBuffer anymore, it will be destroyed in ~SnapshotData(), which will call ~TempSpace() for Firebird::AutoPtr<TempSpace> space, and in ~TempSpace() we will decrease m_tempCacheUsage.
But this doesn't apply to tra_dbcreators_list because we delete it by dropping the transaction pool, so destructor doesn't kick in and we don't decrease m_tempCacheUsage. All of this will cause fb_assert(m_tempCacheUsage == 0) to be thrown, but I don't know what this might lead to in release build (nothing good, I suppose).
This is also true for Firebird 5.0.

If we don't delete it manually assert will be thrown if SEC$DB_CREATORS returns a lot of records
@TreeHunter9
Copy link
Copy Markdown
Contributor Author

Maybe it would be better to wrap tra_dbcreators_list in a smart pointer?

Copy link
Copy Markdown
Member

@AlexPeshkoff AlexPeshkoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also backport this fix to old branches

@AlexPeshkoff AlexPeshkoff merged commit a70a859 into FirebirdSQL:master Aug 6, 2024
@dyemanov
Copy link
Copy Markdown
Member

dyemanov commented Aug 6, 2024

I will backport it.

Comment thread src/jrd/tra.h
tra_user_management(NULL),
tra_sec_db_context(NULL),
tra_mapping_list(NULL),
tra_dbcreators_list(nullptr),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required as every class inherited from pool_alloc has its instance zero-initialized at creation. But I prefer us being more explicit in this regard, so this is a good thing for master.

dyemanov pushed a commit that referenced this pull request Aug 6, 2024
* Delete tra_dbcreators_list in ~jrd_tra

If we don't delete it manually assert will be thrown if SEC$DB_CREATORS returns a lot of records

* Add missing default initialization for tra_dbcreators_list

---------

Co-authored-by: Artyom Ivanov <[email protected]>
@TreeHunter9 TreeHunter9 deleted the master_delete_dbcreators_list branch September 14, 2024 08:13
dyemanov pushed a commit that referenced this pull request Nov 16, 2024
* Delete tra_dbcreators_list in ~jrd_tra

If we don't delete it manually assert will be thrown if SEC$DB_CREATORS returns a lot of records

* Add missing default initialization for tra_dbcreators_list

---------

Co-authored-by: Artyom Ivanov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants