Skip to content

Concurrency Issues in StateRepositories #21

Description

@jadlr

Hi,

I noticed a concurrency bug in the FileBasedStateRepository (writes are not synced) and while implementing a fix for it I noticed that none of the StateRepositories (besides the JDBC Repo) are thread safe, so I thought I'd ask if this is by design? Since you provide a servlet that lets you change the state of StateRepos that are at the same time used by code that leverages togglz I think it would be best to make the StateRepositories thread safe.

In the case of the FileBasedStateRepository this is especially dangerous because the file could be written outside of the JVM while it is written/read by your code. A solution that would depend on the architecture the JVM runs on would be to acquire a FileLock before writing to/reading from it.

Let me know what you think,

jadlr

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