Fix nasa#1401, make OS_QueueGet timeouts monotonic.#1514
Fix nasa#1401, make OS_QueueGet timeouts monotonic.#1514
Conversation
|
mq_timedreceive_monotonic() is not in the POSIX standard. Per what I found on the Net, it is specific to QNX and not supported on Linux, FreeBSD, or RTEMS. Per the POSIX Issue 8 definition of mqueue.h, message queues do not include a function similar to pthread_mutex_clocklock() which lets you specify the clock. poll() is similar to select() in that there it should not be assumed that it will work on anything other than sockets when dealing with an RTOS TCP/IP stack. |
|
Hi @joelsherrill I apologize. Yes, I will review your feedback and make proper changes to the proposed solution to check if it remains viable. Thank you for your response. I'm changing this PR to draft. |
Since the name looks like POSIX function, you need to at least add the suffix of "_np" for non-portable. But since it is provided outside of the OS and libraries, I'd recommend using another name entirely. What does the implementation of that function depend on? |
Hi Joel. Function is now purely internal and no longer exposed in os-posix.h. It depends on:
The helper is now a I’ll continue testing this PR for further improvements. |
Keep the monotonic timeout repair scoped to the Linux path in the POSIX queue backend. Preserve OS_PEND, OS_CHECK and the non-Linux mq_timedreceive() path. While tightening helper naming, poll()/receive behavior and return-value checking. Also make the queue time-jump regression test Linux-only, privilege- gated, bounded and restore CLOCK_REALTIME during teardown.
bb2865d to
d6c08fe
Compare
…ceive-timeout-if-sysclock-changes # Conflicts: # .gitignore
a01346f to
23bc133
Compare
Checklist
Describe the contribution
Fixes #1401. Make
OS_QueueGetfinite timeouts immune toCLOCK_REALTIMEchanges in OSAL POSIX by:OS_Posix_CompAbsDelayTimeMonotonic()andmq_timedreceive_monotonic()(usesCLOCK_MONOTONIC+poll).mq_timedreceive_monotonic()is a new method I implemented to try to fix the issue.CLOCK_REALTIMEforward to test and validate behavior.Testing performed
queue-test.sudo ./queue-testclock_settime+10 seconds every 5 seconds) whileOS_QueueGetcontinues to timeout ~every 1s.All tests PASS:
TOTAL::43 PASS::43 FAIL::0.Expected behavior changes
OS_QueueGetwith a finite timeout is now based on monotonic time; unaffected by wall-clock jumps (settimeofday).OS_PENDandOS_CHECKsemantics unchanged.System(s) tested on
Additional context
clock_settime(CLOCK_REALTIME, …)to simulate wall-clock discontinuities.Third party code
None.
Contributor Info - All information REQUIRED for consideration of pull request
Franco Chiesa Docampo - Personal.