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

text/event-stream Requests Hang Indefinitely When Sablier is Enabled #433

Open
jramsgz opened this issue Oct 29, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@jramsgz
Copy link

jramsgz commented Oct 29, 2024

Describe the bug
When using Pocketbase's real-time database subscriptions (SSE - Server-Sent Events), enabling Sablier causes all text/event-stream requests to remain in a loading state indefinitely. This issue prevents real-time data updates from being transmitted, as the requests never complete or time out.

Context

  • Sablier version: 1.8.1
  • Provider: Docker 27.3.1
  • Reverse proxy: Traefik 3.0.2
  • Deployment: Sablier running inside a container

Expected behavior
Server-Sent Events (SSE) should function normally, with text/event-stream requests completing and delivering real-time updates as intended.

Actual Behavior
When Sablier is enabled, all text/event-stream requests stay in a pending state, and the real-time functionality is effectively broken.

@jramsgz jramsgz added the bug Something isn't working label Oct 29, 2024
@acouvreur
Copy link
Member

Hello @jramsgz

Can you give me a sample to reproduce the issue ?

It should not be blocking indefinitely.

Are you sure you don't get a 307 Temporary Redirect response and your SSE stream is closed on your client side ?

I know we did some hacks for the Traefik plugin because the router is regenerated on every change. Meaning that scaling to zero and up regenerate the middleware and thus, kills all the connections.

For that matter, we respond with a 307 to reload the same uri.

If the SSE supports 307 to re-open SSE stream that might work

@jramsgz
Copy link
Author

jramsgz commented Oct 30, 2024

Hi @acouvreur,

Thank you for the response!

The issue happens when the container is active, not when it’s scaled to zero. When Sablier is enabled in the active container, all text/event-stream requests remain in a pending state, which effectively blocks the SSE stream and prevents real-time updates from coming through. I haven’t tested making an SSE request when scaled to zero, only while it’s active.

Let me know if there are any specific details or logs I can provide to help with troubleshooting. I’ll work on getting a sample to reproduce the issue as soon as possible.

@jramsgz
Copy link
Author

jramsgz commented Oct 30, 2024

See https://github.com/jramsgz/sablier-sse for a sample to reproduce the issue

@acouvreur
Copy link
Member

Hey @jramsgz

Thanks a lot for the sample, could reproduce the bug in no time thanks to your effort.

There is indeed a bug because the middleware does not return a response until the underlying request is done.


We should probably have a special case for that matter.

I'll see if I have time to work on that :)

@acouvreur
Copy link
Member

Note that this should only happen with Traefik, with Caddy the stream is returned instead of wrapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants