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

Requests leak in AutoCacheRequest #7703

Closed
AlexPeshkoff opened this issue Aug 9, 2023 · 1 comment
Closed

Requests leak in AutoCacheRequest #7703

AlexPeshkoff opened this issue Aug 9, 2023 · 1 comment

Comments

@AlexPeshkoff
Copy link
Member

Bug was initially reported by Vasiliy Yashkov vasiliy.yashkov@red-soft.ru. When running a lot of attachments on valgrind enabled built a message arrived:
Memcheck: the 'impossible' happened:
MC_(create_mempool): duplicate pool creation

After analysis of provided simple test case it was found that this happens always with request's pools. The reason is recursive use of AutoCacheRequest - there can be >1 instance of AutoCacheRequest n the stack and outer one overwrites statement, already created by deeper instance.

That was not too dangerous until "Compiled statement cache" implementation, which added dedicated pool for each request, because requests were deleted "by pool" in the end of attachment's life. Currently it may cause memory leak in each attachment - pools are destroyed together with parent pool but memory allocated by them is never freed. (Duplicate pool creation is just visible in valgrind effect of this bug).

@AlexPeshkoff
Copy link
Member Author

testcase.zip
Test to reproduce (requires valgrind - enabled build)

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

2 participants