Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"connection already closed" #6662

Closed
Belorus opened this issue Oct 12, 2021 · 6 comments
Closed

"connection already closed" #6662

Belorus opened this issue Oct 12, 2021 · 6 comments
Labels
wontfix Nobody will work on this.

Comments

@Belorus
Copy link

Belorus commented Oct 12, 2021

uwsgi stderr | The above exception was the direct cause of the following exception:
uwsgi stderr |
uwsgi stderr | Traceback (most recent call last):
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/translation.py", line 301, in store
uwsgi stderr |     return self.load_store()
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/translation.py", line 294, in load_store
uwsgi stderr |     store_post_load.send(sender=self.__class__, translation=self, store=store)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/dispatch/dispatcher.py", line 180, in send
uwsgi stderr |     return [
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
uwsgi stderr |     (receiver, receiver(signal=self, sender=sender, **named))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/addons/models.py", line 319, in store_post_load_handler
uwsgi stderr |     addons = Addon.objects.filter_event(translation.component, EVENT_STORE_POST_LOAD)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/manager.py", line 85, in manager_method
uwsgi stderr |     return getattr(self.get_queryset(), name)(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/addons/models.py", line 75, in filter_event
uwsgi stderr |     return component.addons_cache[event]
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 48, in __get__
uwsgi stderr |     res = instance.__dict__[self.name] = self.func(instance)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/component.py", line 3081, in addons_cache
uwsgi stderr |     for addon in Addon.objects.filter_component(self):
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 280, in __iter__
uwsgi stderr |     self._fetch_all()
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 1324, in _fetch_all
uwsgi stderr |     self._result_cache = list(self._iterable_class(self))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 51, in __iter__
uwsgi stderr |     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/compiler.py", line 1173, in execute_sql
uwsgi stderr |     cursor = self.connection.cursor()
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
uwsgi stderr |     return func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 259, in cursor
uwsgi stderr |     return self._cursor()
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 237, in _cursor
uwsgi stderr |     return self._prepare_cursor(self.create_cursor(name))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/utils.py", line 90, in __exit__
uwsgi stderr |     raise dj_exc_value.with_traceback(traceback) from exc_value
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 237, in _cursor
uwsgi stderr |     return self._prepare_cursor(self.create_cursor(name))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
uwsgi stderr |     return func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/postgresql/base.py", line 236, in create_cursor
uwsgi stderr |     cursor = self.connection.cursor()
uwsgi stderr | django.db.utils.InterfaceError: connection already closed
uwsgi stderr |
uwsgi stderr | During handling of the above exception, another exception occurred:
uwsgi stderr |
uwsgi stderr | Traceback (most recent call last):
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 237, in _cursor
uwsgi stderr |     return self._prepare_cursor(self.create_cursor(name))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
uwsgi stderr |     return func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/postgresql/base.py", line 236, in create_cursor
uwsgi stderr |     cursor = self.connection.cursor()
uwsgi stderr | psycopg2.InterfaceError: connection already closed
uwsgi stderr |
uwsgi stderr | The above exception was the direct cause of the following exception:
uwsgi stderr |
uwsgi stderr | Traceback (most recent call last):
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/exception.py", line 47, in inner
uwsgi stderr |     response = get_response(request)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/base.py", line 181, in _get_response
uwsgi stderr |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
uwsgi stderr |     return view_func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/rest_framework/viewsets.py", line 125, in view
uwsgi stderr |     return self.dispatch(request, *args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 509, in dispatch
uwsgi stderr |     response = self.handle_exception(exc)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 469, in handle_exception
uwsgi stderr |     self.raise_uncaught_exception(exc)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
uwsgi stderr |     raise exc
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 506, in dispatch
uwsgi stderr |     response = handler(request, *args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/api/views.py", line 986, in file
uwsgi stderr |     return download_translation_file(request, obj, fmt)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/decorators.py", line 130, in _wrapped_view
uwsgi stderr |     response = view_func(request, *args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/utils/views.py", line 312, in download_translation_file
uwsgi stderr |     translation.commit_pending("download", None)
uwsgi stderr |   File "/usr/lib/python3.9/contextlib.py", line 79, in inner
uwsgi stderr |     return func(*args, **kwds)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/translation.py", line 536, in commit_pending
uwsgi stderr |     store = self.store
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 48, in __get__
uwsgi stderr |     res = instance.__dict__[self.name] = self.func(instance)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/translation.py", line 306, in store
uwsgi stderr |     self.component.handle_parse_error(exc, self)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/component.py", line 1656, in handle_parse_error
uwsgi stderr |     Change.objects.create(
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/change.py", line 168, in create
uwsgi stderr |     return super().create(user=user, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/manager.py", line 85, in manager_method
uwsgi stderr |     return getattr(self.get_queryset(), name)(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 453, in create
uwsgi stderr |     obj.save(force_insert=True, using=self.db)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/models/change.py", line 494, in save
uwsgi stderr |     super().save(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/base.py", line 726, in save
uwsgi stderr |     self.save_base(using=using, force_insert=force_insert,
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/base.py", line 763, in save_base
uwsgi stderr |     updated = self._save_table(
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/base.py", line 868, in _save_table
uwsgi stderr |     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/base.py", line 906, in _do_insert
uwsgi stderr |     return manager._insert(
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/manager.py", line 85, in manager_method
uwsgi stderr |     return getattr(self.get_queryset(), name)(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 1270, in _insert
uwsgi stderr |     return query.get_compiler(using=using).execute_sql(returning_fields)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/compiler.py", line 1414, in execute_sql
uwsgi stderr |     with self.connection.cursor() as cursor:
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
uwsgi stderr |     return func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 259, in cursor
uwsgi stderr |     return self._cursor()
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 237, in _cursor
uwsgi stderr |     return self._prepare_cursor(self.create_cursor(name))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/utils.py", line 90, in __exit__
uwsgi stderr |     raise dj_exc_value.with_traceback(traceback) from exc_value
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 237, in _cursor
uwsgi stderr |     return self._prepare_cursor(self.create_cursor(name))
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
uwsgi stderr |     return func(*args, **kwargs)
uwsgi stderr |   File "/usr/local/lib/python3.9/dist-packages/django/db/backends/postgresql/base.py", line 236, in create_cursor
uwsgi stderr |     cursor = self.connection.cursor()
uwsgi stderr | django.db.utils.InterfaceError: connection already closed

4.8.1 deployed in k8s with redis / postgres in k8s as well.

Repro:

Create translation string, open 15 other languages from tab Other languages, then update and save them ony by one quickly - and this error happens.

  • name: POSTGRES_CONN_MAX_AGE
    value: '600'
@Belorus Belorus changed the title Lovely "connection already closed" "connection already closed" Oct 12, 2021
@nijel
Copy link
Member

nijel commented Oct 13, 2021

Can you try that without POSTGRES_CONN_MAX_AGE?

@github-actions
Copy link

This issue has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!

@github-actions github-actions bot added the wontfix Nobody will work on this. label Oct 24, 2021
@Belorus
Copy link
Author

Belorus commented Oct 28, 2021

Sorry for long response.

I checked without override that you mentioned - it is slightly worse, since errors occur even during our usual API activity (we continuously export files).

Do you guys host weblate without docker/k8s? We can try hosting it as you usually do to check how it goes. Just to confirm that issue is somehow related to docker/k8s

@github-actions github-actions bot removed the wontfix Nobody will work on this. label Oct 29, 2021
@nijel
Copy link
Member

nijel commented Nov 3, 2021

We do have both Docker and native deployments, and none of our deployments show this.

Typical causes for this errors are:

  • packets being dropped between Weblate and PostgreSQL (networking issue)
  • the PostgreSQL server is dropping connections for some reasons (connection limit being hit or OOM killer can cause this)

@nijel
Copy link
Member

nijel commented Nov 3, 2021

See also WeblateOrg/docker#1108 (comment)

@github-actions
Copy link

This issue has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!

@github-actions github-actions bot added the wontfix Nobody will work on this. label Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix Nobody will work on this.
Projects
None yet
Development

No branches or pull requests

2 participants