-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posix queue depth differs: mqueues vs sockets #191
Comments
Imported from trac issue 168. Created by abrown4 on 2016-05-25T17:58:55, last modified: 2016-08-09T14:01:25 |
Trac comment by jphickey on 2016-08-02 11:55:59: This is a limitation of sockets, as there is no controllable "depth" that correlates to mqueue depth. The closest thing is SO_RCVBUF and SO_SNDBUF socket options, but this is IIRC a byte size and it is also not likely to invoke the same semantics as mqueue depth does. The core of the problem is that UDP sockets are "best-effort", and it is still fundamentally a network protocol even when sending to the localhost. As such, a "send" operation is considered successful if it is queued for //transmit//, regardless of whether there is space on the //receiver// side (the sender doesn't know). CFS, on the other hand, treats queues as "Guaranteed delivery" i.e. when a message is queued it should be guaranteed to arrive at the destination in the same order that they were sent. Using UDP sockets to implement queues actually guarantees neither. This might be OK in a lab, but IMO that is not acceptable for mission-critical data. This is one reason I never ported the socket queue implementation into the "-ng" osal. If POSIX mqueues are not available, then I'd rather see a local implementation based purely on a shared memory with some semaphores to implement blocking read/write operations. Such an implementation would be a benefit to all OS layers as well, not just posix. |
Trac comment by abrown4 on 2016-08-09 14:01:25: As discussed in the 8/9/2016 cFS CCB, I agree with Joe's comments. UDP sockets are hardly a good implementation. Closing this ticket. |
Running the OSAL oscore-test unit test with mqueue vs. sockets (appropriate #define changed in osconfig.h) shows a difference with sockets that wasn't there with mqueues.
{{{
Test #27 Queue-full [FAILED]
FAILED [ ] OS_QueuePut - #27 Queue-full
}}}
Apparently the socket implementation doesn't implement queue depth checks with the same semantics. The socket OS_QueueCreate() queue_depth arg is ignored:
{{{
int32 OS_QueueCreate (uint32 *queue_id, const char *queue_name,
uint32 queue_depth,
uint32 data_size, uint32 flags)
}}}
The socket OS_QueuePut() looks at the bytes sent, returned from sendto(), and compares them to the message data size, but this results different "depth" semantics based on the socket behavior.
The unit test fails because it is expecting the API to honor the queue depth limit and error out on OS_QueuePut(), but it doesn't.
The text was updated successfully, but these errors were encountered: