You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The values sendBufferSize and receiveBufferSize from the SocketTransportDescriptor adequately reflect the buffer sizes of the created UDP sockets.
Current behavior
The values sendBufferSize and receiveBufferSize from the SocketTransportDescriptor and SocketTransportDescriptor::min_send_buffer_size() method return larger values than the actual size of the UDP socket buffers.
Steps to reproduce
Using the fields sendBufferSize and receiveBufferSize from the SocketTransportDescriptor , you must set a value greater than net.core.wmem_max or net.core.rmem_max.
Fast DDS version/commit
v2.13.0
Platform/Architecture
Ubuntu Focal 20.04 amd64
Transport layer
UDPv4
Additional context
No response
XML configuration file
No response
Relevant log output
No response
Network traffic capture
No response
The text was updated successfully, but these errors were encountered:
diff --git a/src/cpp/rtps/transport/UDPTransportInterface.cpp b/src/cpp/rtps/transport/UDPTransportInterface.cpp
index 820056e26..9e9b05ea3 100644
--- a/src/cpp/rtps/transport/UDPTransportInterface.cpp
+++ b/src/cpp/rtps/transport/UDPTransportInterface.cpp
@@ -151,6 +151,53 @@ bool UDPTransportInterface::init(
}
}
}
+
+ // Checking the possibility of setting buffer sizes
+ if (mSendBufferSize != 0 || mReceiveBufferSize != 0)
+ {
+ ip::udp::socket socket(io_service_);
+ socket.open(generate_protocol());
+
+ if (mSendBufferSize != 0)
+ {
+ assert(configuration()->sendBufferSize == mSendBufferSize);
+ socket.set_option(socket_base::send_buffer_size(static_cast<int32_t>(mSendBufferSize)));
+ socket_base::send_buffer_size option;
+ socket.get_option(option);
+ uint32_t real_size = static_cast<uint32_t>(option.value());
+ if (real_size != mSendBufferSize) {
+ EPROSIMA_LOG_ERROR(RTPS_MSG_OUT, "sendBufferSize=" << mSendBufferSize <<
+ " cannot be set (max=" << real_size << ")");
+ set_send_buffer_size(real_size);
+ mSendBufferSize = real_size;
+ // NOTE: I suggest that we consider returning false here (i.e. initialization error).
+ // This will change the behavior (it was not an error before), on the other hand,
+ // it will draw the user's attention to the inability to set the specified buffer size
+ // due to exceeding net.core.wmem_max.
+ // ??? return false; ???
+ }
+ }
+
+ if (mReceiveBufferSize != 0)
+ {
+ assert(configuration()->receiveBufferSize == mReceiveBufferSize);
+ socket.set_option(socket_base::receive_buffer_size(static_cast<int32_t>(mReceiveBufferSize)));
+ socket_base::receive_buffer_size option;
+ socket.get_option(option);
+ uint32_t real_size = static_cast<uint32_t>(option.value());
+ if (real_size != mReceiveBufferSize) {
+ EPROSIMA_LOG_ERROR(RTPS_MSG_OUT, "receiveBufferSize=" << mReceiveBufferSize <<
+ " cannot be set (max=" << real_size << ")");
+ set_receive_buffer_size(real_size);
+ mReceiveBufferSize = real_size;
+ // NOTE: I suggest that we consider returning false here (i.e. initialization error).
+ // This will change the behavior (it was not an error before), on the other hand,
+ // it will draw the user's attention to the inability to set the specified buffer size
+ // due to exceeding net.core.rmem_max.
+ // ??? return false; ???
+ }
+ }
+ }
if (configuration()->maxMessageSize > s_maximumMessageSize)
{
Is there an already existing issue for this?
Expected behavior
The values
sendBufferSize
andreceiveBufferSize
from theSocketTransportDescriptor
adequately reflect the buffer sizes of the created UDP sockets.Current behavior
The values
sendBufferSize
andreceiveBufferSize
from theSocketTransportDescriptor
andSocketTransportDescriptor::min_send_buffer_size()
method return larger values than the actual size of the UDP socket buffers.Steps to reproduce
Using the fields
sendBufferSize
andreceiveBufferSize
from theSocketTransportDescriptor
, you must set a value greater than net.core.wmem_max or net.core.rmem_max.Fast DDS version/commit
v2.13.0
Platform/Architecture
Ubuntu Focal 20.04 amd64
Transport layer
UDPv4
Additional context
No response
XML configuration file
No response
Relevant log output
No response
Network traffic capture
No response
The text was updated successfully, but these errors were encountered: