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

Add manual delete for tra_dbcreators_list #8207

Merged

Conversation

TreeHunter9
Copy link
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
Contributor Author

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

Copy link
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
24 checks passed
@dyemanov
Copy link
Member

dyemanov commented Aug 6, 2024

I will backport it.

@@ -198,6 +198,7 @@ class jrd_tra : public pool_alloc<type_tra>
tra_user_management(NULL),
tra_sec_db_context(NULL),
tra_mapping_list(NULL),
tra_dbcreators_list(nullptr),
Copy link
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 <artyom.ivanov@red-soft.ru>
@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 <artyom.ivanov@red-soft.ru>
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