Skip to content

Conversation

@amgross
Copy link
Contributor

@amgross amgross commented Dec 26, 2024

Pull request

Choose Correct

  • bug
  • feature

Describe the pull request

Closes #443 , Make the token free be from the client management and it will be not matter what is the status

To Reproduce

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS:
  • eRPC Version:

Steps you didn't forgot to do

  • I checked if other PR isn't solving this issue.
  • I read Contribution details and did appropriate actions.
  • PR code is tested.
  • PR code is formatted.
  • Allow edits from maintainers pull request option is set (recommended).

Additional context

@MichalPrincNXP MichalPrincNXP self-assigned this May 12, 2025
@MichalPrincNXP MichalPrincNXP changed the base branch from develop to main May 16, 2025 06:06
@MichalPrincNXP MichalPrincNXP merged commit daa37cd into EmbeddedRPC:main May 16, 2025
2 checks passed
@MichalPrincNXP
Copy link
Member

Thank you for the effort.

ahyros pushed a commit to ahyros/erpc that referenced this pull request Aug 25, 2025
PendingClientInfo *node;

erpc_assert((token != 0) && ("invalid client token" != NULL));
erpc_assert((info->m_sem.getCount() == 0) && ("Semaphore should be clean" != NULL));
Copy link

Choose a reason for hiding this comment

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

This assert will trigger if we follow the non status ok path here:https://github.com/EmbeddedRPC/erpc/pull/444/files#diff-74a78bba1605a2e491d18277550d2c7db7943691c691d14d7a732558f9a0c681L83. Since then nothing has called received. But something may have set a result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry @elupus , I don't understand you, can you please explain the flow deeply please?

Copy link

Choose a reason for hiding this comment

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

If the arbitrator->send call fails for whatever reason. The buffer will be signalled as failed. However the buffer has already been handed of to handed of to another thread (the receiving thread). This other thread can then just have received data that complete this request or it can just have received some aborting read condition.

The race condition ls very tight with master of erpc (but very much there), if you fix some other race conditions like making sure errors are propagated from the arbitrator, the race condition window grows.

In general, if we handed the buffer to another thread we shall always remove it as well. How it was finalized is nothing that make sense to assert on (warning could be fine)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry @elupus , I still don't understand.

On which of the two asserts you talking, the token or semaphore? and if send failed, why other thread has the buffer (and what is your system, the sender and reciever are on same CPU?)

Is this issue that happened to you or theoretical issue?

Can you please explain step by step, with permalink to the relevant lines?

Copy link

@xianyo xianyo Dec 20, 2025

Choose a reason for hiding this comment

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

This assert will trigger if we follow the non status ok path here:https://github.com/EmbeddedRPC/erpc/pull/444/files#diff-74a78bba1605a2e491d18277550d2c7db7943691c691d14d7a732558f9a0c681L83. Since then nothing has called received. But something may have set a result.

I have the same problem assert,How should we solve it?@elupus

Copy link

Choose a reason for hiding this comment

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

I will check how we handle this internally. Since #469 stalled which is semi related i got sidetracked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Arbitrated client token memory leakage

4 participants