node icon indicating copy to clipboard operation
node copied to clipboard

tls: Prevent zero length write() syscalls.

Open rustyconover opened this issue 5 years ago • 7 comments

The current behavior is performing a zero length write() syscall when the write is empty.

This change removes that behavior and prevents a call to the kernel. This change assumes that the zero length write completed async.

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] commit message follows

rustyconover avatar Jan 26 '20 17:01 rustyconover

CI: https://ci.nodejs.org/job/node-test-pull-request/28693/

nodejs-github-bot avatar Jan 26 '20 17:01 nodejs-github-bot

@rustyconover Two things…

  • Does this affect the TCP timeout in any way? My guess is that it doesn’t, but I’d like to be sure.
  • If your goal is to skip zero-length write() calls, I’d assume that a better place is to either do that by skipping DoTryWrite() in StreamBase::Write() (that would affect all C++ streams) or in LibuvStreamWrap::DoTryWrite() (which affects libuv-backed streams, including network sockets)

addaleax avatar Jan 27 '20 16:01 addaleax

Skipping the zero length writes at the StreamBase level would be fine so long as the write callbacks are still handled correctly. I think I'd rather see that approach. That said, when calling DoWrite with an array of uv_buf_t instances, we'd need to look at how to handle an empty uv_buf_t in the middle of the array. What should happen with that. Otherwise I like the general direction of this.

jasnell avatar Jan 27 '20 22:01 jasnell

@rustyconover ... looks like this stalled out. Do you still want to move this forward?

jasnell avatar Jun 25 '20 14:06 jasnell

@jasnell I'd like to see it finished, but right now I've just been a bit distracted.

rustyconover avatar Jun 26 '20 17:06 rustyconover

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

github-actions[bot] avatar Oct 19 '20 18:10 github-actions[bot]

I still think it is a good idea, it is just pending tuits.

rustyconover avatar Oct 19 '20 21:10 rustyconover

(The stalled bot doesn't appear to be working, so I've manually closed. Feel free to reopen if this is no longer stalled)

redyetidev avatar Sep 24 '24 00:09 redyetidev