Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible race condition with background images #143

Open
VikParuchuri opened this issue Dec 19, 2023 · 1 comment
Open

Possible race condition with background images #143

VikParuchuri opened this issue Dec 19, 2023 · 1 comment

Comments

@VikParuchuri
Copy link

VikParuchuri commented Dec 19, 2023

I'm building an app where I swap background images a lot (rendering pdf page images to the canvas).

When I set a background image on a canvas, I get a blank image on the frontend about 20% of the time:

    canvas_result = st_canvas(
        background_image=pil_image,
        ...
    )

Looking at the frontend logs, there's a 404 finding the image. However, trying again a couple of seconds later always works. It's possible there's a race condition in the memory media storage.

I didn't fully investigate the issue, and instead patched it with frontend retry logic here.

I'm opening this issue in case someone else faces the same problem down the line. You can install from my fork with pip install -U git+https://github.com/VikParuchuri/streamlit-drawable-canvas@develop.

@VikParuchuri VikParuchuri changed the title Possible race condition Possible race condition with background images Dec 19, 2023
@tunahsu
Copy link

tunahsu commented Jul 23, 2024

@VikParuchuri same problem here, your solution worked fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants