Skip to content

Unexpected Interaction Between Timeout Middleware and Persistent #1210

@StevenXL

Description

@StevenXL

Hi all,

I am experiencing some unexpected behavior between persistent and the wai-extra's timeout middleware.

In brief, I have instrumented a web application to return a 503 when a request takes longer than 5 seconds to complete. However, under certain scenarios, the application is returning a 500. I have included a script that consistently reproduces the problem on my machine, but I believe that timing is a large part of this issue and can therefore make reproducing the problem tricky.

I have included below some screenshots of the yesod logs and what the end-user experiences below, a screen recording showing that the issue is consistent (again, on my machine), and of the HTTP response.

500-yesod-logs
500-end-user-view

consistent-failure.mov

A few things to note:

  • The script requires postgres to be running via a docker command; command is in comments
  • If I use SELECT pg_sleep(6); SELECT ?? FROM generate_series(1, 90000) AS ser(num) JOIN samples ON (TRUE)" I see the expected 503`
  • I am using a stack resolver in the script, which should hopefully tie down the versions of all dependencies.

I am happy to provide more information if requested - I ignored the template for bug reports because I felt that the requested information was not relevant for this bug, but if I am wrong, I am happy to provide.

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