Opened 10 years ago

Closed 10 years ago

#22879 closed Bug (fixed)

Database errors coming from cursor iterator are not converted to Django database errors

Reported by: denisenkom@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here is one possible situation:

Traceback (most recent call last):
  File "/opt/python-2.7/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/opt/python-2.7/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/denisenk/django-sqlserver/env/src/django/tests/select_for_update/tests.py", line 245, in raw
    connection.ops.for_update_sql(nowait=True)
  File "/home/denisenk/django-sqlserver/env/src/django/django/db/models/query.py", line 1427, in __iter__
    for values in query:
  File "/home/denisenk/django-sqlserver/env/lib/python2.7/site-packages/six.py", line 473, in next
    return type(self).__next__(self)
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/__init__.py", line 703, in __next__
    row = self.fetchone()
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/__init__.py", line 676, in fetchone
    row = self._session.fetchone()
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/tds.py", line 3429, in fetchone
    if not self.next_row():
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/tds.py", line 3443, in next_row
    self.process_end(marker)
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/tds.py", line 2654, in process_end
    self.raise_db_exception()
  File "/home/denisenk/django-sqlserver/env/src/pytds/pytds/tds.py", line 2443, in raise_db_exception
    raise ex
OperationalError: Lock request time out period exceeded.

Change History (7)

comment:1 by Tim Graham, 10 years ago

Component: UncategorizedDatabase layer (models, ORM)
Has patch: set

comment:2 by Aymeric Augustin, 10 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Aymeric Augustin, 10 years ago

Type: UncategorizedBug

comment:4 by Thomas C, 10 years ago

Needs tests: set
Patch needs improvement: set

As discussed on https://github.com/django/django/pull/2839, the patch could be simplified a bit.

comment:5 by Tim Graham, 10 years ago

Patch needs improvement: unset

Patch is now simpler. How about including a regression test for MSSQL Server even if it passes on all the bundled backends?

comment:6 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

According to the PR, there is already such a test in Django's test suite.

comment:7 by Anssi Kääriäinen <akaariai@…>, 10 years ago

Resolution: fixed
Status: newclosed

In d4bc0bf435402f32d1e31aeffd280276349283d8:

Fixed #22879 -- Intercept errors coming from cursor.next()

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