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

cx_oracle throws "DPI-1054: connection cannot be closed when open statements or LOBs exist" during django migration #138

Closed
alfa0ne opened this Issue Jan 23, 2018 · 9 comments

Comments

Projects
None yet
5 participants
@alfa0ne
Copy link

alfa0ne commented Jan 23, 2018

I have connected remote Oracle 9i DB with OCI version 11.2 in my window 7. Connection works fine, but when I run django manage.py migrate command I get DPI-1054: connection cannot be closed when open statements or LOBs exist
Environment :
Python3.6
Django1.11.9
cx_Orcale6.0

Similar issue has been reported to ticket

@anthony-tuininga

This comment has been minimized.

Copy link
Member

anthony-tuininga commented Jan 23, 2018

We are currently investigating the possibility of eliminating this error completely by internally tracking the open statements and LOBs and closing them when connection.close() is called. You can work around the situation by simply avoiding the call to connection.close(). So long as there are no circular references the connection, statements and LOBs will close perfectly well without help!

anthony-tuininga added a commit that referenced this issue Jan 27, 2018

@anthony-tuininga

This comment has been minimized.

Copy link
Member

anthony-tuininga commented Jan 27, 2018

I just pushed a commit that removes this restriction and automatically closes statements and LOBs that are still open when the connection associated with them is closed. This will become part of 6.2 when it is released.

@alfa0ne

This comment has been minimized.

Copy link
Author

alfa0ne commented Jan 30, 2018

Tested the 6.2-dev build for the 9i DB. There is no reported error or exception. Worked all migrations.
Thanks 👍

@elewinso

This comment has been minimized.

Copy link

elewinso commented Feb 2, 2018

I am having the same issue with the following stack.
i cannot update the python version, is there a workaround?

tech stack:
1.
Oracle Database 12c EE Extreme Perf Release 12.2.0.1.
2.
cx driver cx_Oracle-6.1-cp27-cp27mu-manylinux1_x86_64.whl from https://pypi.python.org/pypi/cx_Oracle3.

  1. python version
    2.7.12 (default, Nov 20 2017, 18:23:56)
    [GCC 5.4.0 20160609]
@anthony-tuininga

This comment has been minimized.

Copy link
Member

anthony-tuininga commented Feb 2, 2018

As noted above, you can simply remove the call to connection.close() from within Django. The only other possibilities are to build cx_Oracle from the latest source or wait until 6.2 is released (hopefully in the next couple of weeks).

@elewinso

This comment has been minimized.

Copy link

elewinso commented Feb 4, 2018

Thank you Anthony, the thing is that I am merely running loaddata when this happens. I'm not sure what's the best place to call connection.close()
thanks

@cjbj

This comment has been minimized.

Copy link
Member

cjbj commented Feb 6, 2018

@elewinso the point is to NOT call connection.close(), but to let cx_Oracle clean up in a rational order.

@sushmit86

This comment has been minimized.

Copy link

sushmit86 commented Oct 8, 2018

Has this issue been fixed? I am still getting the error while using connection.close()

@anthony-tuininga

This comment has been minimized.

Copy link
Member

anthony-tuininga commented Oct 8, 2018

Yes, this has been fixed -- in version 6.2 as noted earlier in this thread!

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