Skip to content

lock issues related to redis #6006

@jamesalphanome

Description

@jamesalphanome

lock issues related to redis

I am facing lock issues when running my reflex app, connected to redis, the locks are occuring when I am connecting to a public redis (redis://:yourpassword@<public_ip>:6379), but this is not happening when connecting with a redis on localhost (redis://localhost:6379)

To Reproduce

class A(rx.State, mixin=True):
    """mixin"""

    @rx.event(background=True)
    async def on_success(self):
        raise NotImplementedError("Implement this eventhandler - mixin")

    @rx.event(background=True)
    async def process(self):
        await asyncio.sleep(1)

        yield self.__class__.on_success


class B(A, rx.State):
    """The app state."""

    file_uploading: bool = False

    @rx.event
    async def set_state(self):
        await asyncio.sleep(0.6) # small operation

    @rx.event
    async def completed_toast(self):
        return rx.toast.success("Done.")

    @rx.event(background=True)
    async def on_success(self):
        yield B.completed_toast


def index() -> rx.Component:
    return rx.container(
        rx.color_mode.button(position="top-right"),
        rx.button(
            "Click me",
            on_click=B.process,
        ),
    )


app = rx.App()
app.add_page(index, on_load=B.set_state)

I have a simple repo: repo_link

Expected behavior
No locks, I am not sure what is happening, am I missing something ?

Screenshots

Image
  • Python Version: 3.13
  • Reflex Version: 0.8.21
  • OS: macos
  • Browser (Optional): Chrome

I have a production set up (Azure container apps) that is connected to a single Azure managed redis in a vpn, and I am getting the above lock issues there. It is a bit of a problem. I am getting this issue in reflex 0.7.14 and above. 0.7.13 is working fine.
But even testing with the repo I have shared above, i am getting lock issues when connecting to a public redis with reflex versions as low as 0.6.8 (haven't tested further).

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