Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#22483 closed Bug (fixed)

Oracle test failures due to InterfaceError

Reported by: timo Owned by: aaugustin
Component: Database layer (models, ORM) Version: 1.7-beta-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Bisected to 2e42c859da42a871244aca36162a0aad2b63c02b (#21239)

Example:

$ ./runtests.py --settings=test_oracle migrations
======================================================================
ERROR: test_migrate (migrations.test_commands.MigrateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/django/test/utils.py", line 316, in inner
    return test_func(*args, **kwargs)
  File "/home/tim/code/django/django/test/utils.py", line 216, in inner
    return test_func(*args, **kwargs)
  File "/home/tim/code/django/tests/migrations/test_commands.py", line 44, in test_migrate
    call_command("migrate", verbosity=0)
  File "/home/tim/code/django/django/core/management/__init__.py", line 167, in call_command
    return klass.execute(*args, **defaults)
  File "/home/tim/code/django/django/core/management/base.py", line 337, in execute
    output = self.handle(*args, **options)
  File "/home/tim/code/django/django/core/management/commands/migrate.py", line 145, in handle
    executor.migrate(targets, plan, fake=options.get("fake", False))
  File "/home/tim/code/django/django/db/migrations/executor.py", line 60, in migrate
    self.apply_migration(migration, fake=fake)
  File "/home/tim/code/django/django/db/migrations/executor.py", line 94, in apply_migration
    migration.apply(project_state, schema_editor)
  File "/home/tim/code/django/django/db/migrations/migration.py", line 97, in apply
    operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
  File "/home/tim/code/django/django/db/migrations/operations/fields.py", line 36, in database_forwards
    field,
  File "/home/tim/code/django/django/db/backends/schema.py", line 392, in add_field
    self.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/schema.py", line 95, in execute
    cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/utils.py", line 40, in __exit__
    self.close()
InterfaceError: not connected

Change History (9)

comment:1 Changed 13 months ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 13 months ago by timo

  • Resolution fixed deleted
  • Status changed from closed to new

One failure persists:

./runtests.py --settings=test_oracle transactions --failfast
Testing against Django installed in '/home/tim/code/django/django'
Creating test database for alias 'default'...
Creating test user...
Creating test database for alias 'other'...
Creating test user...
....E
======================================================================
ERROR: test_atomic_prevents_queries_in_broken_transaction_after_client_close (transactions.tests.AtomicErrorsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/django/test/testcases.py", line 925, in skip_wrapper
    return test_func(*args, **kwargs)
  File "/home/tim/code/django/tests/transactions/tests.py", line 373, in test_atomic_prevents_queries_in_broken_transaction_after_client_close
    Reporter.objects.create(first_name="Cuthbert", last_name="Calculus")
  File "/home/tim/code/django/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/tim/code/django/django/db/models/query.py", line 367, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/tim/code/django/django/db/models/base.py", line 603, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/tim/code/django/django/db/models/base.py", line 631, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/home/tim/code/django/django/db/models/base.py", line 712, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/tim/code/django/django/db/models/base.py", line 745, in _do_insert
    using=using, raw=raw)
  File "/home/tim/code/django/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/tim/code/django/django/db/models/query.py", line 916, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 924, in execute_sql
    self.query.get_meta().db_table, self.query.get_meta().pk.column)
  File "/home/tim/code/django/django/db/backends/utils.py", line 40, in __exit__
    self.close()
InterfaceError: not connected

comment:3 Changed 13 months ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned

comment:4 Changed 13 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 5cd64296205e1b5cc4fc1f7e02e22d62795bb604:

[1.7.x] Prevented a crash in the cursor wrappers on Oracle.

Fixed #22483 (again).

Backport of 0f85103e from master

comment:5 Changed 13 months ago by Tim Graham <timograham@…>

In 25209715d44562dcbf26f04ed9e0d19ee3c2aa84:

Prevented a crash in the cursor wrappers on Oracle.

Fixed #22483 (again).

Forwardport of 5cd6429620 from stable/1.7.x

comment:7 Changed 13 months ago by Shai Berger <shai@…>

In 7421e1e320fc46a52af0a1e4518b0ce4344c1a0f:

[1.7.x] Made sure cursor.close() does not complain if cursor is already closed on Oracle

Refs #22483

Backport of 53d97e4fe3 from master

comment:6 Changed 13 months ago by Shai Berger <shai@…>

In 53d97e4fe300f2775b5bb1b8010ec415994fa105:

Made sure cursor.close() does not complain if cursor is already closed on Oracle

Refs #22483

comment:7 Changed 13 months ago by shai

I feel a little uneasy about 25209715d44562dcbf26f04ed9e0d19ee3c2aa84. I think ignoring all backend errors in close(), on all backends, may hide real problems. For the purpose of this ticket, 53d97e4fe300f2775b5bb1b8010ec415994fa105 serves the same purpose with much narrower focus; more generally, I think we should only catch connection.features.closed_cursor_error_class -- I don't think we can reasonably say that any other error should be silenced.

comment:8 Changed 13 months ago by aaugustin

If you can confirm that the test suite still passes on Oracle, yes, please revert my commit.b

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