Skip to content
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

[BUG] eRPC as both client and server on Threadx OS doesn't work #387

Open
2 tasks
sujanpepolla79 opened this issue Oct 16, 2023 · 3 comments
Open
2 tasks
Labels

Comments

@sujanpepolla79
Copy link

sujanpepolla79 commented Oct 16, 2023

Describe the bug

Hello, I am using eRPC on STM32H753 processor on Threadx OS. eRPC works fine if I use it as client or server but code crashes at erpc_framed_transport.cpp at Mutex::Guard lock(m_sendLock) in send() function call when arbitrator client tries to send message. The same code works good on FreeRTOS i.e I am able to use eRPC as both client and server on STM32. I am using ARM CMSIS UART as transport layer on STM32 and the other end Linux ubuntu PC is using eRPC on serial transport layer.
Arbitrator client thread on Threadx OS environment crashes at Mutex::Guard lock(m_sendLock). Two threads have been created on Threadx and one thread is used as server and the second thread is used as client. The server thread starts first and client thread starts later.

To Reproduce

Create two threads on Threadx and use one thread as server and the other thread as client. Code crashes at Mutex::Guard lock receive/send call in erpc_framed_transport.cpp when second thread tries to send/receive message.

This issue is observed only on Threadx OS.
Initialize arbitrator client and server and create two threads.
Use one thread as server and second one as client.
Start server thread first and after some delay start the client thread
Send message from client thread.
No need to run eRPC on linux PC on the other end to reproduce this issue
Code crashes at Mutex::Guard lock(m_sendLock) in erpc_framed_transport.cpp
Expected behavior

Client thread shall able to send notifications . m_sendlock shouldn't block the call since this mutex is being used only by client thread

Screenshots

erpc_server_t server;
erpc_transport_t arbitrator;
erpc_transport_t transport = erpc_transport_cmsis_uart_init((void*)&Driver_USART4);

/* MessageBufferFactory initialization */
erpc_mbf_t message_buffer_factory = erpc_mbf_dynamic_init();

erpc_arbitrated_client_init(transport, message_buffer_factory, &arbitrator);

server = erpc_server_init(arbitrator,message_buffer_factory);
//Create server and client threads

Server thread:
erpc_server_run(server);

Client thread:
//send message(notification)
function_call(true);
Desktop (please complete the following information):

  • OS: Threadx

  • eRPC Version:
    //! @brief String version of eRPC.
    #define ERPC_VERSION "1.10.0"
    //! @brief Integer version of eRPC.
    #define ERPC_VERSION_NUMBER 11000
    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.

Additional context

@github-actions
Copy link

Hi eRPC user. Thank you for your interest and welcome. We hope you will enjoy this framework well.

@sujanpepolla79
Copy link
Author

Hi eRPC,
Any update? Do you accept this as bug?

@Hadatko
Copy link
Member

Hadatko commented Oct 18, 2023

Hi @sujanpepolla79 , we are not authors of this code. This come from community. We don't have ability to fix it by ourself. Could you create PR with bugfix?

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

No branches or pull requests

2 participants