Skip to content

Redis statestore component may create entries without expiration time set if operation is cancelled #3833

Open
@juliannamello

Description

@juliannamello

Expected Behavior

When Set is called with a specified TTL, the cache entry is created with that TTL. If the operation is cancelled, the cache item is either not created or created with the expected TTL.

Actual Behavior

If the Set operation is cancelled, the cache entry may sometimes be created without an expiration time set (i.e., TTL = -1), so it never expires.

It appears this is occurring because the component first calls HSET, which will set the TTL to -1 if the key does not exist, then later calls EXPIRE to properly set the TTL. Because these two operations doe not occur atomically, it is possible for a cache entry to be created without an expiration time.

Steps to Reproduce the Problem

Due to the nature of this issue, it is difficult to reliably reproduce. I set up a small test API app with .NET Core that would set a cache item with a TTL, then used jMeter to call the API many times with a short response timeout, so the connection would be closed.

Release Note

RELEASE NOTE:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions