[#2823] Writing DefaultFileRegion with EpollSocketChannel may cause hang
Motivation: In EpollSocketchannel.doWriteFileRegion(...) we need to make sure we write until sendFile(...) returns either 0 or all is written. Otherwise we may not get notified once the Channel is writable again. This is the case as we use EPOLL_ET. Modifications: Always write until either sendFile returns 0 or all is written. Result: No more hangs when writing DefaultFileRegion can happen.
This commit is contained in:
parent
dd557ca583
commit
b9101b0331
@ -276,7 +276,7 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
||||
boolean done = false;
|
||||
long flushedAmount = 0;
|
||||
|
||||
for (int i = config().getWriteSpinCount() - 1; i >= 0; i --) {
|
||||
for (;;) {
|
||||
final long offset = region.transfered();
|
||||
final long localFlushedAmount = Native.sendfile(fd, region, baseOffset, offset, regionCount - offset);
|
||||
if (localFlushedAmount == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user