Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28498 closed Cleanup/optimization (fixed)

Add cx_Oracle 6 support

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: 1.11
Severity: Release blocker Keywords: cx_Oracle oracle
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

cx_Oracle 6 causes a tests failures due to this change:

Prevent closing the connection when there are any open statements or LOBs and add new error “DPI-1054: connection cannot be closed when open statements or LOBs exist” when this situation is detected; this is needed to prevent crashes under certain conditions when statements or LOBs are being acted upon while at the same time (in another thread) a connection is being closed; it also prevents leaks of statements and LOBs when a connection is returned to a session pool. (see cx_Oracle release notes).

Sample exception:

Traceback (most recent call last):
  File "./runtests.py", line 478, in <module>
    options.exclude_tags,
  File "./runtests.py", line 286, in django_tests
    extra_tests=extra_tests,
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/test/runner.py", line 601, in run_tests
    old_config = self.setup_databases()
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/test/runner.py", line 548, in setup_databases
    self.parallel, **kwargs
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/test/utils.py", line 176, in setup_databases
    serialize=connection.settings_dict.get('TEST', {}).get('SERIALIZE', True),
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/backends/base/creation.py", line 54, in create_test_db
    self._create_test_db(verbosity, autoclobber, keepdb)
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/backends/oracle/creation.py", line 100, in _create_test_db
    self._maindb_connection.close()  # done with main user -- test user and tablespaces created
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/backends/base/base.py", line 281, in close
    self._close()
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/backends/base/base.py", line 243, in _close
    return self.connection.close()
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/jenkins/workspace/django-oracle-master/database/oracle12/label/trusty/python/python3.6/django/db/backends/base/base.py", line 243, in _close
    return self.connection.close()
django.db.utils.DatabaseError: DPI-1054: connection cannot be closed when open statements or LOBs exist}}}

Change History (11)

comment:1 by Tim Graham, 7 years ago

Summary: Added cx_Oracle 6 support.Add cx_Oracle 6 support
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 by Mariusz Felisiak, 7 years ago

Has patch: set

comment:3 by GitHub <noreply@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 6784383:

Fixed #28498 -- Fixed test database creation with cx_Oracle 6.

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 7 years ago

In 07e34f8b:

[1.11.x] Fixed #28498 -- Fixed test database creation with cx_Oracle 6.

Backport of 6784383e93d582f43f8cb5f7647a05645cbb339b from master

comment:5 by Mariusz Felisiak, 7 years ago

Resolution: fixed
Status: closednew

comment:6 by Mariusz Felisiak, 7 years ago

Status: newassigned

comment:7 by Mariusz Felisiak, 7 years ago

Some tests are broken in stable/1.11.x branch on Python 2:

  • backends.tests.BackendTestCase.test_unicode_password:
    Traceback (most recent call last):
      File "/home/jenkins/workspace/django-oracle-1.11/database/oracle12/label/trusty/python/python2.7/tests/backends/tests.py", line 736, in test_unicode_password
        self.fail("Unexpected error raised with unicode password: %s" % e)
    AssertionError: Unexpected error raised with unicode password: 'ascii' codec can't encode character u'\xe7' in position 4: ordinal not in range(128)
    
  • db_functions.tests.FunctionTests.test_greatest_decimal_filter:
    Stacktrace
    
    Traceback (most recent call last):
      File "/home/jenkins/workspace/django-oracle-1.11/database/oracle12/label/trusty/python/python2.7/tests/expressions_case/tests.py", line 734, in test_update_decimal
        transform=attrgetter('integer', 'decimal')
      File "/home/jenkins/workspace/django-oracle-1.11/database/oracle12/label/trusty/python/python2.7/django/test/testcases.py", line 972, in assertQuerysetEqual
        return self.assertEqual(list(items), values, msg=msg)
    AssertionError: Lists differ: [(1, None), (2, Decimal('2.7')... != [(1, Decimal('1.1')), (2, Deci...
    
    First differing element 0:
    (1, None)
    (1, Decimal('1.1'))
    
    - [(1, None),
    + [(1, Decimal('1.1')),
    -  (2, Decimal('2.7')),
    ?                 ^
    
    +  (2, Decimal('2.2')),
    ?                 ^
    
       (3, None),
    -  (2, Decimal('2.7')),
    ?                 ^
    
    +  (2, Decimal('2.2')),
    ?                 ^
    
       (3, None),
       (3, None),
       (4, None)]
    
  • db_functions.tests.FunctionTests.test_least_decimal_filter,
  • db_functions.tests.FunctionTests.test_greatest_decimal_filter.

comment:8 by Mariusz Felisiak, 7 years ago

comment:9 by Tim Graham, 7 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by GitHub <noreply@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 0d21bdd3:

[1.11.x] Fixed #28498 -- Added support for cx_Oracle 6.

  • Fixed implicit Decimal to float conversion when input_size is not

specified for Decimal parameters.

  • Used encoding, nencoding parameters of cx_Oracle.connect() to support

unicode in DSN.

Thanks Tim Graham for the review.

comment:11 by Mariusz Felisiak <felisiak.mariusz@…>, 7 years ago

In 939d923e:

Refs #28498 -- Forwardported 1.11.5 release note.

Note: See TracTickets for help on using tickets.
Back to Top