Changes between Initial Version and Version 1 of Ticket #29760, comment 9


Ignore:
Timestamp:
Nov 26, 2019, 10:48:17 AM (4 years ago)
Author:
Kurt Wheeler

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29760, comment 9

    initial v1  
    1 I'm getting the same error, while using the `iterator()` method of a queryset:
    2 {{{
    3 Traceback (most recent call last):
    4   File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 96, in inner
    5     return func(*args, **kwargs)
    6 psycopg2.OperationalError: cursor "_django_curs_140027036677888_1" does not exist
    7 The above exception was the direct cause of the following exception:
    8 Traceback (most recent call last):
    9   File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1512, in cursor_iter
    10     for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
    11   File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1512, in <lambda>
    12     for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
    13   File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 96, in inner
    14     return func(*args, **kwargs)
    15   File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__
    16     raise dj_exc_value.with_traceback(traceback) from exc_value
    17   File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 96, in inner
    18     return func(*args, **kwargs)
    19 django.db.utils.OperationalError: cursor "_django_curs_140027036677888_1" does not exist
    20 During handling of the above exception, another exception occurred:
    21 Traceback (most recent call last):
    22   File "/home/user/data_refinery_workers/processors/utils.py", line 369, in run_pipeline
    23     last_result = processor(last_result)
    24   File "/home/user/data_refinery_workers/processors/qn_reference.py", line 241, in _update_caches
    25     for experiment in unique_experiments.iterator():
    26   File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 341, in _iterator
    27     yield from self._iterable_class(self, chunked_fetch=use_chunked_fetch, chunk_size=chunk_size)
    28   File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 72, in __iter__
    29     for row in compiler.results_iter(results):
    30   File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1515, in cursor_iter
    31     cursor.close()
    32 psycopg2.OperationalError: cursor "_django_curs_140027036677888_1" does not exist
    33 }}}
    34 
    35 This is the line of code that is causing that error https://github.com/AlexsLemonade/refinebio/blob/dev/workers/data_refinery_workers/processors/qn_reference.py#L241
    36 
    37 Any idea why my cursor is disappearing? I don't think I'm doing anything unusual in my code there. The queryset it's iterating over seems to be ~20k records.
    38 
    39 The only other thing I can think of that might be non-standard about my configuration is that I have a pg_bouncer instance set up to batch database connections. It seems to do a good job of pretending to be the postgres server itself, but maybe this is a place that it doesn't?
Back to Top