GLEAM Galactic Plane transient rating app is a web-based candidate classifier for team members to easily classify transient candidates. The transient candidates are detected in the MWA's weekly monitoring of the galactic plane.
When I search for candidates in the candidate table view, I get errors (shown below). I triggered this by searching on position using the format requested on the page, with a search radius of 60 arcmin.
`
InterfaceError at /candidate_table/
cursor already closed
Request Method:
POST
https://mwa-image-plane.duckdns.org/candidate_table/
4.0.3
InterfaceError
cursor already closed
/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py, line 98, in inner
/home/ubuntu/.local/bin/uwsgi
3.8.10
['.', '', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/ubuntu/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/shpc', '/usr/lib/python3/dist-packages']
Wed, 07 Feb 2024 06:06:56 +0000
You’re seeing this error because you haveDEBUG = Truein your Django settings file. Change that toFalse, and Django will display a standard page generated by the handler for this status code.
InterfaceError at /candidate_table/
cursor already closed
Request Method: POST
Request URL: https://mwa-image-plane.duckdns.org/candidate_table/
Django Version: 4.0.3
Exception Type: InterfaceError
Exception Value:
cursor already closed
Exception Location: /home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py, line 98, in inner
Python Executable: /home/ubuntu/.local/bin/uwsgi
Python Version: 3.8.10
Python Path:
['.',
'',
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/usr/lib/python3.8/lib-dynload',
'/home/ubuntu/.local/lib/python3.8/site-packages',
'/usr/local/lib/python3.8/dist-packages',
'/shpc',
'/usr/lib/python3/dist-packages']
Server time: Wed, 07 Feb 2024 06:06:56 +0000
Error during template rendering
In template /home/ubuntu/GleamXGPMonitoring/gleam_webapp/templates/candidate_app/candidate_table.html, error at line 23
Template error:
In template /home/ubuntu/GleamXGPMonitoring/gleam_webapp/templates/candidate_app/candidate_table.html, error at line 23
cursor already closed
13 :
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner
return func(*args, **kwargs)
The above exception (cursor already closed) was the direct cause of the following exception:
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, callback_kwargs)
File "/home/ubuntu/GleamXGPMonitoring/gleam_webapp/./candidate_app/views.py", line 464, in candidate_table
return render(request, 'candidate_app/candidate_table.html', content)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/shortcuts.py", line 24, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/backends/django.py", line 62, in render
return self.template.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 175, in render
return self._render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader_tags.py", line 63, in render
result = block.nodelist.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1065, in render
return render_value_in_context(output, context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1042, in render_value_in_context
value = str(value)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/utils/html.py", line 382, in
klass.str = lambda self: mark_safe(klass_str(self))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/boundfield.py", line 34, in str
return self.as_widget()
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/boundfield.py", line 99, in as_widget
return widget.render(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 275, in render
context = self.get_context(name, value, attrs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 729, in get_context
context = super().get_context(name, value, attrs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 688, in get_context
context["widget"]["optgroups"] = self.optgroups(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 628, in optgroups
for index, (option_value, option_label) in enumerate(self.choices):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/models.py", line 1400, in iter
for obj in queryset:
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/query.py", line 401, in _iterator
yield from self._iterable_class(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/query.py", line 87, in iter
for row in compiler.results_iter(results):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1873, in cursor_iter
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1873, in
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner
return func(*args, *kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner
return func(args, kwargs)
Exception Type: InterfaceError at /candidate_table/
Exception Value: cursor already closed
Request information
USER
nhurleywalker
GET
No GET data
POST
Variable Value
csrfmiddlewaretoken
'0N4pbdZ3xh37giFC33uiOiU06cUwr1XGXe0RGYOdbEYfs8QINkSEjYgcHw2E0ctj'
rating_cutoff
''
observation_id
''
column_display
'None'
order_by
'avg_rating'
asc_dec
'-'
ra_hms
'18:32:00'
dec_dms
'-09:11:00'
search_radius_arcmin
'60'
FILES
No FILES data
Either this is intermittent or it has been resolved by changes made during development so far. I'm going to label this as "cannot reproduce" and we can revisit if the error occurs again.
When I search for candidates in the candidate table view, I get errors (shown below). I triggered this by searching on position using the format requested on the page, with a search radius of 60 arcmin.
InterfaceError at /candidate_table/
Request Method:https://mwa-image-plane.duckdns.org/candidate_table/ 4.0.3 InterfaceError cursor already closed /home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py, line 98, in inner /home/ubuntu/.local/bin/uwsgi 3.8.10 ['.', '', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/ubuntu/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/shpc', '/usr/lib/python3/dist-packages'] Wed, 07 Feb 2024 06:06:56 +0000
You’re seeing this error because you have
DEBUG = True
in your Django settings file. Change that toFalse
, and Django will display a standard page generated by the handler for this status code.cursor already closed Exception Location: /home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py, line 98, in inner Python Executable: /home/ubuntu/.local/bin/uwsgi Python Version: 3.8.10 Python Path:
['.', '', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/ubuntu/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/shpc', '/usr/lib/python3/dist-packages'] Server time: Wed, 07 Feb 2024 06:06:56 +0000 Error during template rendering In template /home/ubuntu/GleamXGPMonitoring/gleam_webapp/templates/candidate_app/candidate_table.html, error at line 23
cursor already closed 13
Request Method: POST Request URL: https://mwa-image-plane.duckdns.org/candidate_table/
Django Version: 4.0.3 Python Version: 3.8.10 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'rest_framework.authtoken', 'candidate_app'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']
Template error: In template /home/ubuntu/GleamXGPMonitoring/gleam_webapp/templates/candidate_app/candidate_table.html, error at line 23 cursor already closed 13 :
Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner return func(*args, **kwargs)
The above exception (cursor already closed) was the direct cause of the following exception: File "/home/ubuntu/.local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/home/ubuntu/GleamXGPMonitoring/gleam_webapp/./candidate_app/views.py", line 464, in candidate_table return render(request, 'candidate_app/candidate_table.html', content) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/shortcuts.py", line 24, in render content = loader.render_to_string(template_name, context, request, using=using) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/backends/django.py", line 62, in render return self.template.render(context) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 175, in render return self._render(context) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/loader_tags.py", line 63, in render
result = block.nodelist.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1000, in
return SafeString("".join([node.render_annotated(context) for node in self]))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 958, in render_annotated
return self.render(context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1065, in render
return render_value_in_context(output, context)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/template/base.py", line 1042, in render_value_in_context
value = str(value)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/utils/html.py", line 382, in
klass.str = lambda self: mark_safe(klass_str(self))
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/boundfield.py", line 34, in str
return self.as_widget()
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/boundfield.py", line 99, in as_widget
return widget.render(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 275, in render
context = self.get_context(name, value, attrs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 729, in get_context
context = super().get_context(name, value, attrs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 688, in get_context
context["widget"]["optgroups"] = self.optgroups(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/widgets.py", line 628, in optgroups
for index, (option_value, option_label) in enumerate(self.choices):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/forms/models.py", line 1400, in iter
for obj in queryset:
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/query.py", line 401, in _iterator
yield from self._iterable_class(
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/query.py", line 87, in iter
for row in compiler.results_iter(results):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1873, in cursor_iter
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1873, in
for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner
return func(*args, *kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/ubuntu/.local/lib/python3.8/site-packages/django/db/utils.py", line 98, in inner
return func(args, kwargs)
Exception Type: InterfaceError at /candidate_table/ Exception Value: cursor already closed
Request information USER nhurleywalker
GET No GET data
POST Variable Value csrfmiddlewaretoken '0N4pbdZ3xh37giFC33uiOiU06cUwr1XGXe0RGYOdbEYfs8QINkSEjYgcHw2E0ctj' rating_cutoff
'' observation_id
'' column_display
'None' order_by
'avg_rating' asc_dec '-' ra_hms
'18:32:00' dec_dms '-09:11:00' search_radius_arcmin
'60' FILES No FILES data
COOKIES Variable Value csrftoken
<_io.TextIOWrapper name=2 mode='w' encoding='UTF-8'> wsgi.file_wrapper'XCYlI0GA328VCb8ocTaeaiWpH3NDf7K8U3UNdLvKHp33O1juWayAFYiBinVLOigL' sessionid
'2j5dsoroyfjoicdfoxhjk8ntdbjy74d4' META Variable Value CONTENT_LENGTH
'231' CONTENT_TYPE
'application/x-www-form-urlencoded' CSRF_COOKIE 'XCYlI0GA328VCb8ocTaeaiWpH3NDf7K8U3UNdLvKHp33O1juWayAFYiBinVLOigL' CSRF_COOKIE_NEEDS_UPDATE
True DOCUMENT_ROOT
'/usr/share/nginx/html' HTTPS
'on' HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7' HTTP_ACCEPT_ENCODING
'gzip, deflate, br' HTTP_ACCEPT_LANGUAGE
'en-US,en;q=0.9' HTTP_CACHE_CONTROL
'max-age=0' HTTP_CONNECTION 'keep-alive' HTTP_CONTENT_LENGTH '231' HTTP_CONTENT_TYPE
'application/x-www-form-urlencoded' HTTP_COOKIE ('csrftoken=XCYlI0GA328VCb8ocTaeaiWpH3NDf7K8U3UNdLvKHp33O1juWayAFYiBinVLOigL; ' 'sessionid=2j5dsoroyfjoicdfoxhjk8ntdbjy74d4') HTTP_HOST
'mwa-image-plane.duckdns.org' HTTP_ORIGIN 'https://mwa-image-plane.duckdns.org' HTTP_REFERER
'https://mwa-image-plane.duckdns.org/candidate_table/' HTTP_SEC_CH_UA
'"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"' HTTP_SEC_CH_UA_MOBILE
'?0' HTTP_SEC_CH_UA_PLATFORM '"Linux"' HTTP_SEC_FETCH_DEST 'document' HTTP_SEC_FETCH_MODE 'navigate' HTTP_SEC_FETCH_SITE 'same-origin' HTTP_SEC_FETCH_USER '?1' HTTP_UPGRADE_INSECURE_REQUESTS
'1' HTTP_USER_AGENT ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/120.0.0.0 Safari/537.36') PATH_INFO
'/candidate_table/' QUERY_STRING
'' REMOTE_ADDR '134.7.50.183' REMOTE_PORT '45050' REQUEST_METHOD
'POST' REQUEST_SCHEME
'https' REQUEST_URI '/candidate_table/' SCRIPT_NAME '' SERVER_NAME 'mwa-image-plane.duckdns.org' SERVER_PORT '443' SERVER_PROTOCOL 'HTTP/1.1' uwsgi.node
b'mwa-image-plane-v2' uwsgi.version
b'2.0.20' wsgi.errors
Either this is intermittent or it has been resolved by changes made during development so far. I'm going to label this as "cannot reproduce" and we can revisit if the error occurs again.
"wontfix" is as close to "cannot reproduce as I can find.
I have replaced this page with a new version so this bug is now closed.