Skip to content

IntegrityError when clearing request log with in-flight request #824

@c-w

Description

@c-w

I occasionally see FOREIGN KEY constraint failed errors coming from silk; my hypothesis is that it's caused by the following race condition:

  1. a request comes into django
  2. silk creates a Request record
  3. silk_clear_request_log runs, deleting all Request records
  4. django is done with the request
  5. silk tries to insert a Response record referencing the Request record from step 2
  6. IntegrityError is raised as step 3 deleted the Request that the Response is referencing

For now, I'm working around the issue with my own cleanup command that skips deleting any in-flight requests, but perhaps it's something that could be handled directly by silk_clear_request_log?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions