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

RxNetty hangs after sending more than 45 Kbytes of data without flushing #571

Closed
sdeleuze opened this issue Dec 6, 2016 · 7 comments
Closed

Comments

@sdeleuze
Copy link

sdeleuze commented Dec 6, 2016

As demonstrated in this sample repro project, RxNetty HTTP server seems to block without sending any data to the client when writing more than approximatively 45 Kbytes, for example when using ResponseContentWriter#writeString(Observable<String>). Maybe the flush triggered by complete is never reached because Netty send buffer is full.

Shouldn't RxNetty handle this case? I would assume RxNetty to auto-flush the data before reaching Netty send buffer limit. If these is expected, could you please explain how can I deal with that use case?

This issue has been discovered as part of Spring Web Reactive benchmarks, see https://jira.spring.io/browse/SPR-14943 for more details.

Thanks in advance for your feedback.

@sdeleuze sdeleuze changed the title RxNetty hangs when the send buffer is full RxNetty hangs after sending more than 45 Kbytes of data without flushing Dec 6, 2016
@NiteshKant
Copy link
Member

Maybe the flush triggered by complete is never reached because Netty send buffer is full.

The problem here is that the source does not complete, due to lack of requestN which is caused by write buffer reaching the high watermark.

Good or bad, RxNetty requires explicit flushing and does not do anything related to flushing automagically. I initiated a feature in netty to support AutoFlush a while back but it hasn't yet been merged. My take is that these usecases would be handled by AutoFlush better, until then you can define your batching strategies using a flush selector

@sdeleuze
Copy link
Author

sdeleuze commented Dec 7, 2016

Ok thanks for your feedback.

@sdeleuze sdeleuze closed this as completed Dec 7, 2016
@sdeleuze
Copy link
Author

sdeleuze commented Dec 7, 2016

@NiteshKant Just a last question, should I expect multiple threads access on a specific flush selector instance created for each write call? I would like to know if this simple implementation is ok, or if I should care about concurrent access to FlushSelector#count?

@sdeleuze sdeleuze reopened this Dec 7, 2016
@NiteshKant
Copy link
Member

should I expect multiple threads access on a specific flush selector instance created for each write call?

There would not be concurrent access, but you will have to take care of visibility as it may be invoked by different threads at different times.

@sdeleuze
Copy link
Author

sdeleuze commented Dec 8, 2016

Could you explain what you mean by "you will have to take care of visibility"?

@NiteshKant
Copy link
Member

@sdeleuze

Flush selector can be invoked by multiple threads but not concurrently. So, if you have shared state, modifications to this state may not be visible across invocations of the flush selector.

@sdeleuze
Copy link
Author

Ok thanks

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

No branches or pull requests

2 participants