Skip to content

[WIP] [#1573] Enhance degradation handler [Rust, no bindings]#1575

Open
elBoberido wants to merge 31 commits intomainfrom
iox2-1573-enhance-degradation-handler-rust-part
Open

[WIP] [#1573] Enhance degradation handler [Rust, no bindings]#1575
elBoberido wants to merge 31 commits intomainfrom
iox2-1573-enhance-degradation-handler-rust-part

Conversation

@elBoberido
Copy link
Copy Markdown
Member

@elBoberido elBoberido commented Apr 22, 2026

Notes for Reviewer

Pre-Review Checklist for the PR Author

  • Add sensible notes for the reviewer
  • PR title is short, expressive and meaningful
  • Consider switching the PR to a draft (Convert to draft)
    • as draft PR, the CI will be skipped for pushes
  • Relevant issues are linked in the References section
  • Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  • Commits messages are according to this guideline
    • Commit messages have the issue ID ([#123] Add posix ipc example)
    • Keep in mind to use the same email that was used to sign the Eclipse Contributor Agreement
  • Tests follow the best practice for testing
  • Changelog updated in the unreleased section including API breaking changes

PR Reviewer Reminders

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

References

Relates to #1573

@elBoberido elBoberido force-pushed the iox2-1573-enhance-degradation-handler-rust-part branch 6 times, most recently from e266995 to 651a740 Compare April 23, 2026 05:50
@elBoberido elBoberido self-assigned this Apr 23, 2026
@elBoberido elBoberido force-pushed the iox2-1573-enhance-degradation-handler-rust-part branch from 651a740 to 74d91e3 Compare April 23, 2026 11:54
Comment thread iceoryx2-cal/src/zero_copy_connection/mod.rs Outdated
Comment thread examples/rust/publish_subscribe_with_unable_to_deliver_handler/publisher.rs Outdated
Comment thread examples/rust/publish_subscribe_with_unable_to_deliver_handler/publisher.rs Outdated
Comment thread examples/rust/publish_subscribe_with_unable_to_deliver_handler/publisher.rs Outdated
Comment thread examples/rust/publish_subscribe_with_unable_to_deliver_handler/README.md Outdated
Comment thread examples/README.md Outdated
mgmt.channels[channel_id.value()].submission_queue.is_full()
&& is_connected
&& has_valid_channel_state
if is_connected && has_valid_channel_state {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maybe break request response. I think the channel state corresponds to the request id and if the channel state changes at all the blocking send operation must be stopped since now a different pending response is using this channel for another request.

But I am unsure - could you try to check if this would be true? As soon as I find a space to concentrate I will try to confirm this but this maybe hard in the next hours.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i am wrong

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take a look into this, but the behavior should be the same as right now

Copy link
Copy Markdown
Member Author

@elBoberido elBoberido Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I checked the logic and it is indeed the same as before regarding to stopping blocking operations. If any of

  • mgmt.channels[channel_id.value()].submission_queue.is_full()
  • is_connected
  • has_valid_channel_state

is false, the wait loop will abort. The only difference is that if all three conditions are true, there is still the possibility that the handler decides to leave the wait loop.

But my initial changes are superfluous, so I change it back to have all three conditions in the same if statement

Comment thread iceoryx2-cal/src/zero_copy_connection/mod.rs Outdated
LoanErrorInternalFailure,
/// A failure occurred while establishing a connection to the ports counterpart port.
ConnectionError,
/// The request could not be delivered
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the response side is missing. It is possible that an ActiveRequest is unable to send the ResponseMut to its PendingResponse counterpart.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I taught it is guaranteed the the response will always be delivered?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no iox2_request_send_error_e in the C bindings or a RequestSendError in the C++ bindings but the response branch of request-response seems to use the generic SendError.

Comment thread iceoryx2-ffi/python/tests/config_tests.py
Comment thread iceoryx2-cal/src/zero_copy_connection/mod.rs Outdated
Comment thread iceoryx2-cal/src/zero_copy_connection/mod.rs Outdated
return iox2_request_send_error_e_LOAN_ERROR_INTERNAL_FAILURE;
case iox2::RequestSendError::ConnectionError:
return iox2_request_send_error_e_CONNECTION_ERROR;
case iox2::RequestSendError::UnableToDeliver:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt here a ResponseSendError missing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory not. I had the assumption that a response can never fail, since there is no overflow for the responses and the queue is as large as the amount of active requests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
DegradationAction::Fail => {
fail!(from self, with e, "Unable to establish connection to new sender {:?}.",
DegradationAction::AbortOperationAndFail => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really struggle with giving the user that option since this clearly violates the freedom of interference for me. I understand and accept that the user needs to be able to do this. But I would love to have an unsafe enum here or something comparable where a safety section (our term of safety) clearly states that this might break the freedom of intereference and the user must be cautious.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same category of violation the freedom of interference like when the publisher decides not to send data anymore to any subscriber?

It is not the subscriber that is so slow that influences the other subscriber, but an deliberate act of the publisher, like stopping to send samples on Friday.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this:

  • rename AbortDeliveryAndFail to DiscardSampleAndFail and AbortOperationAndFail to DegradeOperationAndFail
  • DiscardSampleAndFail would discard the sample for the receiver that blocks and try to deliver to the remaining receivers
  • DegradeOperationAndFail would ignore the broken connection and continue with the remaining ones
  • in the send call, where the degradation as well as the unable to deliver handler could be called, the degradation error has a higher priority and if both occur, the initial degradation error will be returned
  • if an EINTR occurs, the DegradeOperationAndFail action will make the call fail immediately

What do you think?

Comment thread iceoryx2/src/port/mod.rs Outdated
Comment thread iceoryx2/src/service/port_factory/client.rs Outdated
Comment thread iceoryx2/src/service/port_factory/server.rs Outdated
Comment thread iceoryx2/src/service/port_factory/server.rs Outdated
Comment thread iceoryx2/src/service/port_factory/server.rs Outdated
Comment thread iceoryx2/src/service/port_factory/subscriber.rs Outdated
@elBoberido elBoberido force-pushed the iox2-1573-enhance-degradation-handler-rust-part branch 2 times, most recently from eb8636c to a40f2f2 Compare April 24, 2026 12:32
@elBoberido elBoberido force-pushed the iox2-1573-enhance-degradation-handler-rust-part branch 2 times, most recently from 212a8fe to 65c730a Compare April 24, 2026 21:44
@elBoberido elBoberido force-pushed the iox2-1573-enhance-degradation-handler-rust-part branch from 65c730a to a2aa490 Compare April 24, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants