Skip to content

Collisions in updated_at when POSTing late_bytes #86

@kavorite

Description

@kavorite

This report comes from @Bash-09. The offending lines are these:

session_id, old_late_bytes = conn.execute(
sa.text(
"""SELECT session_id, late_bytes FROM demo_sessions
WHERE steam_id = :steam_id
AND updated_at = (
SELECT MAX(updated_at) FROM demo_sessions WHERE steam_id = :steam_id
);
""",
),
{"steam_id": steam_id},
).one()

Clients periodically get a 500 during header overwrites because this query returns multiple results, causing one() to throw an exception.

The easy fix is to use first() here instead of one(); still, I think it merits an investigation into why multiple entries of demo_sessions with identical updated_at fields exist. More comprehensive changes to the database schema could also make it easier to disambiguate which session the requester last interacted with.

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