minvws / nl-kat-coordination

Repo nl-kat-coordination for minvws
European Union Public License 1.2
122 stars 55 forks source link

Uploading large number of objects results in #2743

Open stephanie0x00 opened 4 months ago

stephanie0x00 commented 4 months ago

Please add bug, the name of any relevant modules (e.g. rocky), and any other relevant labels to your issue.

Describe the bug Uploading the alexa top 1000 via the CSV upload functionality gives a RemoteException: AssertionError: ('_AsyncTransportBase._initate_abort() expected non-_STATE_COMPLETED', 4) error.

To Reproduce Steps to reproduce the behavior:

  1. Go to Objects
  2. Add the Alexa Top 1000 objects via the CSV upload.
  3. Wait until the error message is shown.
  4. See error

Expected behavior Upload Alexa top 1000 via CSV upload works without any issues.

Screenshots

image

OpenKAT version commit a629fe4b129e2f06e30ac7302584d45e89bbe122 (HEAD)

Environment:

Request Method: POST
Request URL: http://kattest01.openkat.dev/en/test/objects/upload/csv/

Django Version: 4.2.11
Python Version: 3.11.8
Installed Applications:
['whitenoise.runserver_nostatic',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.forms',
 'django_otp',
 'django_otp.plugins.otp_static',
 'django_otp.plugins.otp_totp',
 'two_factor',
 'account',
 'tools',
 'fmea',
 'crisis_room',
 'onboarding',
 'katalogus',
 'django_password_validators',
 'django_password_validators.password_history',
 'rest_framework',
 'tagulous',
 'compressor',
 'reports',
 'knox',
 'csp']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'rocky.middleware.remote_user.RemoteUserMiddleware',
 'django_otp.middleware.OTPMiddleware',
 'rocky.middleware.auth_required.AuthRequiredMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'rocky.middleware.onboarding.OnboardingMiddleware',
 'csp.middleware.CSPMiddleware']

Traceback (most recent call last):
  File "/app/rocky/octopoes/connector/octopoes.py", line 47, in _verify_response
    response.raise_for_status()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 761, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception (Server error '500 Internal Server Error' for url 'http://octopoes_api/test/scan_profiles?valid_time=2024-03-29%2010%3A04%3A04.360106%2B00%3A00'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500), another exception occurred:
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/generic/edit.py", line 153, in post
    return self.form_valid(form)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/rocky/rocky/views/upload_csv.py", line 136, in form_valid
    if not self.process_csv(form):
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/rocky/rocky/views/upload_csv.py", line 171, in process_csv
    self.raise_clearance_level(ooi.reference, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/rocky/account/mixins.py", line 132, in raise_clearance_level
    self.octopoes_api_connector.save_scan_profile(
    ^
  File "/app/rocky/octopoes/connector/octopoes.py", line 178, in save_scan_profile
    self.session.put(
    ^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1182, in put
    return self.request(

  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 827, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 914, in send
    response = self._send_handling_auth(

  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 942, in _send_handling_auth
    response = self._send_handling_redirects(

  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 999, in _send_handling_redirects
    raise exc
    ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 982, in _send_handling_redirects
    hook(response)
    ^^^^^^^^^^^^^^
  File "/app/rocky/octopoes/connector/octopoes.py", line 54, in _verify_response
    raise RemoteException(value=data["value"])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: RemoteException at /en/test/objects/upload/csv/
Exception Value: AssertionError: ('_AsyncTransportBase._initate_abort() expected non-_STATE_COMPLETED', 4)
originalsouth commented 3 months ago

Cannot reproduce on my system... image

image

originalsouth commented 3 months ago

alexa-top1000.csv