WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.63k stars 1.02k forks source link

InvalidCursorName error during save of a translation #4539

Closed tsabi closed 4 years ago

tsabi commented 4 years ago

This is a fresh new install. Installed into a clean ubuntu 20.04 LXC followed the instructions from the guide.

Created my first project, and than created the first three component by hand, and the other components through the rest api. The first component points to the git repo, the latter compoments points to the first component if that matters.

Steps: Tryed to translate my first text, and i got this error message:

InvalidCursorName at /translate/odoo13/hr_recruitment/hu/ cursor "_django_curs_139740833630080_sync_3" does not exist

Server configuration and status

root@c126-weblate:/srv/weblate-env# bin/weblate list_versions DEBUG git: exec git --version [retcode=0] DEBUG git: exec git --version [retcode=0] DEBUG git: exec git review --version [retcode=0] DEBUG git: exec git review --version [retcode=0] DEBUG git: exec git svn --version [retcode=1] DEBUG git: exec git svn --version [retcode=1] DEBUG lab: exec lab --version [retcode=1] DEBUG lab: exec lab --version [retcode=1] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.name Weblate merge driver for Gettext PO files [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.name Weblate merge driver for Gettext PO files [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.driver /srv/weblate-env/lib/python3.8/site-packages/weblate/examples/git-merge-gettext-po %O %A %B [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.driver /srv/weblate-env/lib/python3.8/site-packages/weblate/examples/git-merge-gettext-po %O %A %B [retcode=0] DEBUG git: exec git config --global user.email noreply@weblate.org [retcode=0] DEBUG git: exec git config --global user.email noreply@weblate.org [retcode=0] DEBUG git: exec git config --global user.name Weblate [retcode=0] DEBUG git: exec git config --global user.name Weblate [retcode=0]

Weblate deploy checks

root@c126-weblate:/srv/weblate-env# bin/weblate check --deploy DEBUG git: exec git --version [retcode=0] DEBUG git: exec git --version [retcode=0] DEBUG git: exec git review --version [retcode=0] DEBUG git: exec git review --version [retcode=0] DEBUG git: exec git svn --version [retcode=1] DEBUG git: exec git svn --version [retcode=1] DEBUG lab: exec lab --version [retcode=1] DEBUG lab: exec lab --version [retcode=1] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.name Weblate merge driver for Gettext PO files [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.name Weblate merge driver for Gettext PO files [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.driver /srv/weblate-env/lib/python3.8/site-packages/weblate/examples/git-merge-gettext-po %O %A %B [retcode=0] DEBUG git: exec git config --global merge.weblate-merge-gettext-po.driver /srv/weblate-env/lib/python3.8/site-packages/weblate/examples/git-merge-gettext-po %O %A %B [retcode=0] DEBUG git: exec git config --global user.email noreply@weblate.org [retcode=0] DEBUG git: exec git config --global user.email noreply@weblate.org [retcode=0] DEBUG git: exec git config --global user.name Weblate [retcode=0] DEBUG git: exec git config --global user.name Weblate [retcode=0] System check identified some issues:

WARNINGS: ?: (security.W018) You should not have DEBUG set to True in deployment. ?: (weblate.W025.xwiki-fullpage) Failure in loading handler for xwiki-fullpage file format: module 'translate.storage.properties' has no attribute 'XWikiFullPage' HINT: https://docs.weblate.org/en/weblate-4.2.2/admin/install.html#optional-deps ?: (weblate.W025.xwiki-java-properties) Failure in loading handler for xwiki-java-properties file format: module 'translate.storage.properties' has no attribute 'xwikifile' HINT: https://docs.weblate.org/en/weblate-4.2.2/admin/install.html#optional-deps ?: (weblate.W025.xwiki-page-properties) Failure in loading handler for xwiki-page-properties file format: module 'translate.storage.properties' has no attribute 'XWikiPageProperties' HINT: https://docs.weblate.org/en/weblate-4.2.2/admin/install.html#optional-deps ?: (weblate.W033.GitHub) Failure in loading VCS module for GitHub: [Errno 2] No such file or directory: 'hub' HINT: https://docs.weblate.org/en/weblate-4.2.2/vcs.html ?: (weblate.W033.Mercurial) Failure in loading VCS module for Mercurial: [Errno 2] No such file or directory: 'hg' HINT: https://docs.weblate.org/en/weblate-4.2.2/vcs.html ?: (weblate.W033.Subversion) Failure in loading VCS module for Subversion: git: 'svn' is not a git command. See 'git --help'.

The most similar commands are fsck mv show (1) HINT: https://docs.weblate.org/en/weblate-4.2.2/vcs.html

INFOS: ?: (weblate.I021) Error collection is not set up, it is highly recommended for production use HINT: https://docs.weblate.org/en/weblate-4.2.2/admin/install.html#collecting-errors ?: (weblate.I028) Backups are not configured, it is highly recommended for production use HINT: https://docs.weblate.org/en/weblate-4.2.2/admin/backup.html

System check identified 9 issues (1 silenced).

Exception traceback

Environment:

Request Method: POST Request URL: https://***********/translate/odoo13/hr_recruitment/hu/?q=state%3A%3Ctranslated&offset=2

Django Version: 3.1.1 Python Version: 3.8.2 Installed Applications: ['weblate.addons', 'weblate.auth', 'weblate.checks', 'weblate.formats', 'weblate.glossary', 'weblate.machinery', 'weblate.trans', 'weblate.lang', 'weblate.langdata', 'weblate.memory', 'weblate.screenshots', 'weblate.fonts', 'weblate.accounts', 'weblate.utils', 'weblate.vcs', 'weblate.wladmin', 'weblate', 'weblate.gitexport', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin.apps.SimpleAdminConfig', 'django.contrib.admindocs', 'django.contrib.sitemaps', 'django.contrib.humanize', 'social_django', 'crispy_forms', 'compressor', 'rest_framework', 'rest_framework.authtoken', 'django_filters'] Installed Middleware: ['weblate.middleware.RedirectMiddleware', 'weblate.middleware.ProxyMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'weblate.accounts.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware', 'weblate.accounts.middleware.RequireLoginMiddleware', 'weblate.api.middleware.ThrottlingMiddleware', 'weblate.middleware.SecurityMiddleware']

Traceback (most recent call last): File "/srv/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 97, in inner return func(*args, **kwargs)

The above exception (cursor "_django_curs_139740833630080_sync_3" does not exist ) was the direct cause of the following exception: File "/srv/weblate-env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1606, in cursor_iter for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel): File "/srv/weblate-env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1606, in for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel): File "/srv/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 97, in inner return func(*args, *kwargs) File "/srv/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/srv/weblate-env/lib/python3.8/site-packages/django/db/utils.py", line 97, in inner return func(args, **kwargs)

During handling of the above exception (cursor "_django_curs_139740833630080_sync_3" does not exist ), another exception occurred: File "/srv/weblate-env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/srv/weblate-env/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/trans/views/edit.py", line 492, in translate response = handle_translate(request, unit, this_unit_url, next_unit_url) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/utils/ratelimit.py", line 111, in rate_wrap return function(request, *args, *kwargs) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/trans/views/edit.py", line 306, in handle_translate go_next = perform_translation(unit, form, request) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/trans/views/edit.py", line 247, in perform_translation saved = unit.translate(request.user, new_target, form.cleaned_data["state"]) File "/usr/lib/python3.8/contextlib.py", line 75, in inner return func(args, kwds) File "/srv/weblate-env/lib/python3.8/site-packages/django/db/transaction.py", line 276, in exit connection.set_autocommit(True) File "/srv/weblate-env/lib/python3.8/site-packages/django/db/backends/base/base.py", line 420, in set_autocommit self.run_and_clear_commit_hooks() File "/srv/weblate-env/lib/python3.8/site-packages/django/db/backends/base/base.py", line 651, in run_and_clear_commit_hooks func() File "/srv/weblate-env/lib/python3.8/site-packages/weblate/trans/models/translation.py", line 999, in transaction.on_commit(lambda: self.stats.invalidate(recurse=recurse)) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/utils/stats.py", line 347, in invalidate self._object.component.stats.invalidate(language=self._object.language) File "/srv/weblate-env/lib/python3.8/site-packages/weblate/utils/stats.py", line 643, in invalidate for clist in self._object.componentlist_set.iterator(): File "/srv/weblate-env/lib/python3.8/site-packages/django/db/models/query.py", line 360, in _iterator yield from self._iterable_class(self, chunked_fetch=use_chunked_fetch, chunk_size=chunk_size) File "/srv/weblate-env/lib/python3.8/site-packages/django/db/models/query.py", line 70, in iter for row in compiler.results_iter(results): File "/srv/weblate-env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1609, in cursor_iter cursor.close()

Exception Type: InvalidCursorName at /translate/odoo13/hr_recruitment/hu/ Exception Value: cursor "_django_curs_139740833630080_sync_3" does not exist

Additional context

Add any other context about the problem here.

nijel commented 4 years ago

I haven't seen this one yet. What might be worth checking:

github-actions[bot] commented 4 years ago

This issue looks like a support question. We try to answer these reasonably fast, but in case you are looking for faster resolution, please consider purchasing support subscription and make Weblate stronger.

tsabi commented 4 years ago

It was connected to a pgbouncer running on localhost, now i connected to the postgresql itself, and now it works.

The pgbouncer was setted up to work in transaction mode, do you have a recommended setup?

Thanks for the help! I really appreciate it! This software looks so promising, if we implement is successfully at our company, i am sure we will donate some :)

nijel commented 4 years ago

I'd stick with session pooling on pgbouncer, otherwise you might end up seeing such errors because some read only actions do not use transactions on Weblate side and using cursors then apparently breaks. Most likely pgbouncer routes cursor creation to a different connection than its usage in that case. See http://www.pgbouncer.org/features.html

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.