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

sentry keeps informing about crash in validate_version_metadata_task #1805

Closed
yarikoptic opened this issue Jan 4, 2024 · 4 comments · Fixed by #1808
Closed

sentry keeps informing about crash in validate_version_metadata_task #1805

yarikoptic opened this issue Jan 4, 2024 · 4 comments · Fixed by #1808
Labels
released This issue/pull request has been released.

Comments

@yarikoptic
Copy link
Member

Issue
AttributeError dandiapi.api.tasks.validate_version_metadata_task
'NoneType' object has no attribute 'status'

recent one was

ID: 5e2381c945b34e9babff2c6b274f9102
Dec. 31, 2023, 6:17:37 a.m. UTC

project     dandi-api
environment staging
level       error

  Exception

AttributeError: 'NoneType' object has no attribute 'status'
  File "dandiapi/api/tasks/__init__.py", line 60, in validate_version_metadata_task
    validate_version_metadata(version=version)
  File "dandiapi/api/services/metadata/__init__.py", line 137, in validate_version_metadata
    version.status = Version.Status.VALIDATING

but initially there was

error   AttributeError dandiapi.api.tasks.validate_version_metadata_task
        'NoneType' object has no attribute 'status'

ID: fdf5db2e73f44043b6f6b14f818b0f7d
Feb. 28, 2023, 4:24:06 p.m. UTC

  Suspect Commits

         Move metadata validation tasks into the service layer
MV
   7d3d994 —  Mike VanDenburgh

  Exception

AttributeError: 'NoneType' object has no attribute 'status'
  File "dandiapi/api/tasks/__init__.py", line 78, in validate_version_metadata_task
    validate_version_metadata(version=version)
  File "dandiapi/api/services/metadata/__init__.py", line 124, in validate_version_metadata
    version.status = Version.Status.VALIDATING

so might be worth checking that 7d3d994 . @mvandenburgh ?

@mvandenburgh
Copy link
Member

Link to the sentry issue: https://dandiarchive.sentry.io/issues/4782773513/?project=5266078&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=14d&stream_index=5

This happened because the version being validated got deleted after the validation function got called, but before we re-queried for it with select_for_update to lock it - https://github.com/dandi/dandi-archive/blob/master/dandiapi/api/services/metadata/__init__.py#L130-L136. Essentially, the version got deleted while it was being validated.

This only happened once in staging, which makes sense as deleting versions is much more common there.

@yarikoptic
Copy link
Member Author

Thanks for the analysis and explanation! But could code be fixed for that (e.g. if version is None -- add a comment that likely is gone and do not do those steps any longer) regardless that it is "staging only" and non-consequential really?

@mvandenburgh
Copy link
Member

Thanks for the analysis and explanation! But could code be fixed for that (e.g. if version is None -- add a comment that likely is gone and do not do those steps any longer) regardless that it is "staging only" and non-consequential really?

Yes I agree that makes sense to do - I opened #1808 to fix this.

@dandibot
Copy link
Member

dandibot commented Jan 4, 2024

🚀 Issue was released in v0.3.71 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants