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

MultipleObjectsReturned on manage regenerate_cached_suggestions #381

Open
erictapen opened this issue Nov 21, 2024 · 2 comments
Open

MultipleObjectsReturned on manage regenerate_cached_suggestions #381

erictapen opened this issue Nov 21, 2024 · 2 comments
Labels
bug Something isn't working data something about quality or quantity of ingested data

Comments

@erictapen
Copy link
Contributor

After #378, when running manage regenerate_cached_suggestions, I get this error after a while:

INFO 2024-11-21 09:33:41,227 cache_suggestions 222192 139727664719680 CVE 'CVE-2024-35678' suggestion cached for the first time
INFO 2024-11-21 09:33:41,389 cache_suggestions 222192 139727664719680 CVE 'CVE-2024-35684' suggestion cached for the first time
INFO 2024-11-21 09:33:41,535 cache_suggestions 222192 139727664719680 CVE 'CVE-2024-35695' suggestion cached for the first time
Traceback (most recent call last):
  File "/home/kerstin/git/nix-security-tracker/src/website/manage.py", line 23, in <module>
    main()                                                                                                                             
  File "/home/kerstin/git/nix-security-tracker/src/website/manage.py", line 19, in main
    execute_from_command_line(sys.argv)
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/core/management/__init
__.py", line 442, in execute_from_command_line
    utility.execute()                                              
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/core/management/__init
__.py", line 436, in execute                                       
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/core/management/base.p
y", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/core/management/base.p
y", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kerstin/git/nix-security-tracker/src/website/shared/management/commands/regenerate_cached_suggestions.py", line 21, in ha
ndle
    cache_new_suggestions(suggestion)
  File "/home/kerstin/git/nix-security-tracker/src/website/shared/listeners/cache_suggestions.py", line 83, in cache_new_suggestions
    _, created = CachedSuggestions.objects.update_or_create(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/db/models/manager.py",
 line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/db/models/query.py", l
ine 949, in update_or_create
    obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/db/models/query.py", l
ine 916, in get_or_create
    return self.get(**kwargs), False
           ^^^^^^^^^^^^^^^^^^
  File "/nix/store/czy8aaqwkypcwnw9ckcz9rj387mhfm6n-python3.12-django-4.2.16/lib/python3.12/site-packages/django/db/models/query.py", l
ine 640, in get
    raise self.model.MultipleObjectsReturned(
shared.models.cached.CachedSuggestions.MultipleObjectsReturned: get() returned more than one CachedSuggestions -- it returned 2!

Any ideas, @RaitoBezarius @fricklerhandwerk ?

@erictapen erictapen added the bug Something isn't working label Nov 21, 2024
@erictapen
Copy link
Contributor Author

Interestingly this only happens sometimes?

@fricklerhandwerk fricklerhandwerk added the data something about quality or quantity of ingested data label Nov 29, 2024
@RaitoBezarius
Copy link
Collaborator

A lack of integrity on the cached suggestion I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data something about quality or quantity of ingested data
Projects
Status: No status
Development

No branches or pull requests

3 participants