-
Notifications
You must be signed in to change notification settings - Fork 891
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
[RESTEASY-2985] Only run the complete listeners if a 204 response is … #3827
Conversation
Sure, I'm OK with the approach. I was trying to pass the TCK. Can you share the fix with me so I can also try it? Are you fixing the TCK directly? |
Oops, sorry yes. The fix will just be setting the system property |
Ah, I should have checked the code. Thanks! Unfortunately, even with the switch, the TCK fails :( |
Okay. I was just hoping it would work. The change in #3722 is definitely different. I can look into that issue a bit more as well. |
Yes, the issue here is that with Vert.x the response gets closed way sooner, so when the status is updated, you don't see it in the response. If you want to try it with minimal effort, you can run: https://github.com/quarkiverse/quarkus-microprofile/tree/main/tck/rest And: You do need to update the RESTEasy dependencies to use the SNAPSHOT. I've used |
Perfect, thank you! I'll give that a try, possibly tomorrow. |
…received. Note that an SseEventSink.close() in RESTEasy will result in a 204. In other implementations, this results in a 200. Add a way to override this with a system property or configuration parameter. See jakartaee/rest#1007 for details. https://issues.redhat.com/browse/RESTEASY-2985 Signed-off-by: James R. Perkins <jperkins@redhat.com>
Is this now working with Quarkus? :) |
I would guess not, but maybe. I think the Quarkus error was different with a race of some sort in Vert.x. |
@jamezp Would you please revisit the issue described here? I also provided steps on how to reproduce it. RESTEasy (6.2.6) never realizes that a sink was closed by the client, doesn't complete the
and the CompletionStage seems to never, ever complete in this situation where the sink was closed by the client. |
@PrimevalCoder Do you use an |
No, because my use case is similar to the one of the person who asked that StackOverflow question: I need to send specific events to specific client sinks, not broadcast to all of them. I know WebSockets might solve the problem easier, but our team decided to settle for SSE in this case. So we're keeping the sinks into a |
So far from what I see when the |
Thanks a lot. Please try to find out why it doesn't realize the sink is closed when the browser/tab (that created the EventSource) is closed, either, (without necessarily calling
and it results in a TimeoutException (completes normally and very fast with sinks that are actually open). |
I have a similar use-case and it seems that I also have some weird behavior. |
I don't really have a good Quarkus reproducer, I'll have to see if I can find some time, but I've not been able to reproduce this in WildFly or with the |
On top of the RESTEasy bug, the specification is quite silly by not mandating a callback for the SSE connection closure event (e.g. Node.js has this out-of-the-box), so if you have a use case where you don't close the sink explicitly on the server side after performing some operations, you could probably save a lot of headache by using websockets instead, where you have the |
I am sadly bound to resteasy v4.7.9.Final by company restrictions. There is work being done to migrate to Quarkus v3.x but it will not happen before autumn. What I am doing now is implementing an endpoint to only close sinks on the backend. Thanks for the insight @PrimevalCoder |
Good to hear you found a solution that works for you. In our situation, connections have to remain open for very long periods of time, even hours, while the server waits for data from another service, so unfortunately we couldn't go for an algorithm where we perform some operations synchronously, and close the sink at the end; we had to store the sink objects and send the events to each when that other service sends us the data. |
From what I understand there is nothing in the SSE Spec that indicates when an If anyone has a reproducer, I'd be happy to have a look though. When I created one, I was not seeing any issues. However, I was also using WildFly not Quarkus. |
I left some instructions on how to reproduce it in my first replies here. I will try to provide a complete Quarkus project maybe during the weekend. But in any case, it would be normal to at least have |
Hi again, @jamezp. I made this demo for you to see what I mean regarding the resteasy.bug.demo.conv.mp4 |
Thank you @PrimevalCoder. A reproducer would be great, thank you! And no need to apologize, I completely understand :) |
Thanks for your time, too. I sent you an invite to the repo. |
@PrimevalCoder Here's what I see locally and possibly what I'd expect. If I connect a client and then close it, on the next request the |
…received. Note that an SseEventSink.close() in RESTEasy will result in a 204. In other implementations, this results in a 200. Add a way to override this with a system property or configuration parameter. See jakartaee/rest#1007 for details.
https://issues.redhat.com/browse/RESTEASY-2985
This potentially replaces #3554. However, there is an attempt to not full undo #1361.
@radcortez Would this work for you as a replacement for #3722?
Note the TCK will fail on
ee.jakarta.tck.ws.rs.jaxrs21.ee.sse.sseeventsource.JAXRSClientIT.connectionLostFor1500msTest
. Locally I've got a simple change to fix this, but I'd like to get an approval on this approach before I send a PR up to fix that test.