Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server helper: Suppress error of UDPServer over max_bytes on Windows
This fix just suppresses the error message and output a info level log. On Windows, `UDPSocket::recv` and `UDPSocket::recvfrom` can raise `Errno::EMSGSIZE` error when the receiving data size is larger than the `maxlen`, the value specified as the method's argument. (On non-Windows, this error doesn't happen, and we can receive data that is cut off to the specified size.) We need to consider this case since this causes an unexpected error message as follows. unexpected error in processing UDP data error_class=Errno::EMSGSIZE error="A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. - recvfrom(2)" On Windows, we can't cut data off the same way as Non-Windows. So, the data is simply ignored on Windows. It is not a big problem since cutting data off usually causes a failure of parsing and the data is eventually ignored. We want information about what data is ignored, but it is difficult to know it. That is an issue for the future. Ref: `winsock` specification * https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom * https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 Ref: Ruby implementation * https://github.com/ruby/ruby/blob/e51014f9c05aa65cbf203442d37fef7c12390015/win32/win32.c#L3540-L3589 * https://github.com/ruby/ruby/blob/e51014f9c05aa65cbf203442d37fef7c12390015/win32/win32.c#L3730-L3782 Signed-off-by: Daijiro Fukuda <[email protected]>
- Loading branch information