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

Cursor context manager is missing __aexit__ #15

Open
ilosamart opened this issue Jul 23, 2021 · 1 comment
Open

Cursor context manager is missing __aexit__ #15

ilosamart opened this issue Jul 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ilosamart
Copy link

Describe the bug
Potential memory leak in cursors context manager.

To Reproduce
Call many times cursor.fetchone().

Gist with sample code: https://gist.github.com/ilosamart/272a7dadb639f19fd62b7947ae12ab5f
It contains three versions of the same method: one async (this lib), one async (this lib) which explicitly closes the cursor, one with pure cx_oracle.

Expected behavior
I expected that the cursor context manager closed the cursor.

Platform:

  • OS: Ubuntu 20.04
  • Oracle version: 12.2
  • Python version 3.8

Additional context
I used the instructions on https://oracle.github.io/odpi/doc/user_guide/debugging.html to debug memory alloc inside OCI.

@ilosamart ilosamart added the bug Something isn't working label Jul 23, 2021
@GoodManWEN
Copy link
Owner

Thank you very much for the bug report, and sorry for taking a long time to reply, dont't know if you have already solved the problem, seems like I happened to ignore the issue notification email at the time.

According to your description, this can lead to serious consequences in certain scenarios. Unfortunately I'm not familiar with the memory leak debug tool you provided, could you please provide more detailed debug logs so that we can identify the exact location of the leak? According to my understanding that arose from your code on gist, it shows that using cursor object with context manager causes unreleased problem and calling close manually solves it? I am not sure if I understand it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants