Skip to content

Mismatch state between django and elastic on crash during analysis #151

@trpyn

Description

@trpyn

If an error occurs during an analysis and crashes the process (happens with some apk files within xapk packages), the apk is considered "existing" as its hash is stored in the db, but the analysis never occurs. This results in the impossibility to re-start an analysis of this apk. The report is not shown in the search results.

Here django finds the hash:

django-1         | INFO:     172.25.0.1:58078 - "GET /api/exists/b903386562662b61aeee551ad46cdf850c4b40d2c996298bafcff51dc60e543b HTTP/1.1" 200 OK

But fetching the report doesn't work because it doesn't exist on elastic's side

django-1         | ERROR 2026-01-20 15:24:23,482 view 51 139649922102976 NotFoundError(404, "{'_index': 'apk_analysis', '_id': 'b903386562662b61aeee551ad46cdf850c4b40d2c996298bafcff51dc60e543b', 'found': False}")
[...] # skip traceback
django-1         | elasticsearch.NotFoundError: NotFoundError(404, "{'_index': 'apk_analysis', '_id': 'b903386562662b61aeee551ad46cdf850c4b40d2c996298bafcff51dc60e543b', 'found': False}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions