Opened 3 years ago

Closed 3 weeks ago

Last modified 3 weeks ago

#35225 closed Cleanup/optimization (fixed)

Tests of ordering by JSON field fail in Oracle 21c

Reported by: raydeal Owned by: Jacob Walls
Component: Database layer (models, ORM) Version: 5.0
Severity: Normal Keywords:
Cc: Loïc LEFEVRE 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

There are 2 tests that fail in Oracle 21c.

ERROR [0.011s]: test_order_by_key (db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_key)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests/django/tests/db_functions/comparison/test_json_object.py", line 100, in test_order_by_key
    self.assertQuerySetEqual(qs, Author.objects.order_by("alias"))
  File "/tests/django/django/test/testcases.py", line 1228, in assertQuerySetEqual
    return self.assertEqual(list(items), values, msg=msg)
                            ^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 400, in __iter__
    self._fetch_all()
  File "/tests/django/django/db/models/query.py", line 1928, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 123, in __iter__
    for row in compiler.results_iter(results):
  File "/tests/django/django/db/models/sql/compiler.py", line 1508, in apply_converters
    value = converter(value, expression, connection)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/backends/oracle/operations.py", line 246, in convert_textfield_value
    value = value.read()
            ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/oracledb/lob.py", line 130, in read
    return self._impl.read(offset, amount)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/oracledb/impl/thin/lob.pyx", line 254, in oracledb.thin_impl.ThinLobImpl.read
  File "src/oracledb/impl/thin/lob.pyx", line 197, in oracledb.thin_impl.ThinLobImpl._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 425, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 426, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 419, in oracledb.thin_impl.Protocol._process_message
oracledb.exceptions.DatabaseError: ORA-24826: value LOB no longer available
Help: https://docs.oracle.com/error-help/db/ora-24826/
ERROR [0.010s]: test_order_by_nested_key (db_functions.comparison.test_json_object.JSONObjectTests.test_order_by_nested_key)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tests/django/tests/db_functions/comparison/test_json_object.py", line 106, in test_order_by_nested_key
    self.assertQuerySetEqual(qs, Author.objects.order_by("-alias"))
  File "/tests/django/django/test/testcases.py", line 1228, in assertQuerySetEqual
    return self.assertEqual(list(items), values, msg=msg)
                            ^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 400, in __iter__
    self._fetch_all()
  File "/tests/django/django/db/models/query.py", line 1928, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/models/query.py", line 123, in __iter__
    for row in compiler.results_iter(results):
  File "/tests/django/django/db/models/sql/compiler.py", line 1508, in apply_converters
    value = converter(value, expression, connection)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tests/django/django/db/backends/oracle/operations.py", line 246, in convert_textfield_value
    value = value.read()
            ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/oracledb/lob.py", line 130, in read
    return self._impl.read(offset, amount)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/oracledb/impl/thin/lob.pyx", line 254, in oracledb.thin_impl.ThinLobImpl.read
  File "src/oracledb/impl/thin/lob.pyx", line 197, in oracledb.thin_impl.ThinLobImpl._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 425, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 426, in oracledb.thin_impl.Protocol._process_single_message
  File "src/oracledb/impl/thin/protocol.pyx", line 419, in oracledb.thin_impl.Protocol._process_message
oracledb.exceptions.DatabaseError: ORA-24826: value LOB no longer available
Help: https://docs.oracle.com/error-help/db/ora-24826/

Change History (8)

comment:1 by Mariusz Felisiak, 3 years ago

Interesting they pass on Oracle 23c.

comment:2 by Mariusz Felisiak, 3 years ago

Resolution: → needsinfo
Status: new → closed

I don't think you've explained the issue in enough detail to confirm a bug in Django. This looks like an issue in python-oracledb, some related library, your local installation, or a bug in Oracle 21c itself. As far as I'm aware, Django doesn't do anything specific to free LOBs. Please reopen the ticket if you can debug your issue and provide details about why and where Django is at fault.

comment:3 by Jacob Walls, 3 weeks ago

Cc: Loïc LEFEVRE added
Resolution: needsinfo
Status: closed → new
Triage Stage: Unreviewed → Accepted

Loïc raised this with the oracledb team, and they suggested that since this only reproduces on Oracle 21c, and since 21c no longer receives this category of bugfixes, we should just add a test skip in Django.

comment:4 by Jacob Walls, 3 weeks ago

Owner: changed from nobody to Jacob Walls
Status: new → assigned

comment:5 by Jacob Walls, 3 weeks ago

Has patch: set

comment:6 by Jacob Walls, 3 weeks ago

Triage Stage: Accepted → Ready for checkin

Clifford approved on GitHub.

comment:7 by Jacob Walls <jacobtylerwalls@…>, 3 weeks ago

Resolution: → fixed
Status: assigned → closed

In 63d898bd:

Fixed #35225 -- Skipped JSONObject ordering tests on Oracle 21c.

comment:8 by Jacob Walls <jacobtylerwalls@…>, 3 weeks ago

In 8be9c122:

Refs #35225 -- Fixed typo in test skip.

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