Menu

#337 PD request in multithread application, concurrency problems with msg/sockets

2.0.3.0
closed
None
2020-08-21
2020-05-22
No

Application has 2 PD threads:

  • sender-thread for sending PD messages
  • receiver-thread for receiving PD messages

Application logic includes PD pull pattern (PD request&reply), sometimes both threads are handling same PD-send-structures and the end result is unpredictable.

Based on debugging in Linux (no TSN configured), following errors have been seen:

  • vos_sockSendUDP() trying to send 0 bytes
  • vos_sockSendUDP() trying to send 144 bytes (when message is actually 72 bytes)
  • tlp_processReceive() returning -35 (TRDP_CRC_ERR)
  • tlp_processSend() returning -7 (TRDP_IO_ERR)

Discussion

  • Bernd Löhr

    Bernd Löhr - 2020-07-15
    • status: open --> accepted
    • assigned_to: Bernd Löhr
     
  • Bernd Löhr

    Bernd Löhr - 2020-07-15

    The problem seems to be the sending of the reply from within the pdReceive function. The receive thread must aquire the Tx mutex, while holding the Rx mutex.
    Currently, when debugging a test case (test3 in api_test_3.c), I see every now and then the TRDP_CRC_ERR, but after taking the Tx mutex on PD Pull requests, it disappears – seems OK.
    Can you replicate/verify that problem?

     

    Last edit: Bernd Löhr 2020-07-15
  • Bernd Löhr

    Bernd Löhr - 2020-07-15
    • status: accepted --> pending
     
  • Kari Keinanen

    Kari Keinanen - 2020-08-04

    Just tested with current trunk, looks good, I couldn't reproduce the problem.
    Ticket can be closed.

     
  • Bernd Löhr

    Bernd Löhr - 2020-08-21
    • Status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB