You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens-G (via GitHub)" <gi...@apache.org> on 2026/10/14 21:52:57 UTC
[PR] THRIFT-6417: Treat a zero-byte write as an error in the socket, fd and SSL transports [thrift]
Jens-G opened a new pull request, #4008:
URL: https://github.com/apache/thrift/pull/4008
`thrift_socket_write()`, `thrift_fd_transport_write()` and `thrift_ssl_socket_write()` call `send()`, `write()` and `SSL_write()` until the whole buffer has gone out. A call that returns 0 for a non-empty buffer has made no progress, and repeating it cannot make any, so the write now fails with a `GError` instead of asking again: `THRIFT_TRANSPORT_ERROR_SEND` for the socket and fd transports, and for `SSL_write()`, which signals a failed write with any value <= 0, the same SSL error as for a negative result.
C++ handles these results the same way: `TSocket::write_partial()` and `TFDTransport::write()` throw on a 0 from `send()` and `write()`, and `TSSLSocket::write()` checks the `SSL_write()` result for <= 0.
Tests: `testtransportsocket`, `testfdtransport` and `testtransportsslsocket` each get a test that substitutes the system call with one that returns 0. Without the change the three tests fail, with it they pass. `testfdtransport` now includes `thrift_fd_transport.c`, as the socket tests do with their transports, so that it can substitute `write()`. `make -C lib/c_glib/test check-am`: 32/32 (Ubuntu 22.04 build image).
JIRA: [THRIFT-6417](https://issues.apache.org/jira/browse/THRIFT-6417)
- [x] Apache Jira ticket: THRIFT-6417
- [x] PR title follows "THRIFT-NNNN: describe my issue"
- [x] Single commit
- [x] Code change, so the commit carries no CI-skip marker.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-6417: Treat a zero-byte write as an error in the socket, fd and SSL transports [thrift]
Posted by "Jens-G (via GitHub)" <gi...@apache.org>.
Jens-G merged PR #4008:
URL: https://github.com/apache/thrift/pull/4008
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org