-
Notifications
You must be signed in to change notification settings - Fork 244
Closed
Labels
Description
Describe the bug
In ArbitratedClientManager::performClientRequest, in case of none oneway API token is aquired:
token = m_arbitrator->prepareClientReceive(request); |
The token is released just as part of calling m_arbitrator->clientReceive(token), but this call is done just if codec status is OK:
erpc/erpc_c/infra/erpc_arbitrated_client_manager.cpp
Lines 83 to 86 in 5c2c6b7
if (request.getCodec()->isStatusOk() == true) | |
{ | |
// Complete the receive through the arbitrator. | |
err = m_arbitrator->clientReceive(token); |
Hence if m_arbitrator->send fails, the token won't get released:
erpc/erpc_c/infra/erpc_arbitrated_client_manager.cpp
Lines 77 to 78 in 5c2c6b7
err = m_arbitrator->send(&request.getCodec()->getBufferRef()); | |
request.getCodec()->updateStatus(err); |
To Reproduce
Loop calls of none oneway API on arbitrated client, where transport layer send fails.
You expect in first tomes to get the send fail, till memory leakege block your system and then the token getting will fail:
erpc/erpc_c/infra/erpc_arbitrated_client_manager.cpp
Lines 59 to 62 in 5c2c6b7
if (token == 0U) | |
{ | |
request.getCodec()->updateStatus(kErpcStatus_Fail); | |
} |
Expected behavior
Token is always released before exiting ArbitratedClientManager::performClientRequest
Screenshots
Desktop (please complete the following information)
- OS: windows
- eRPC Version:1.13.0
Steps you didn't forgot to do
- I checked if there is no related issue opened/closed.
- I checked that there doesn't exist opened PR which is solving this issue.