open62541 / open62541

Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
http://open62541.org
Mozilla Public License 2.0
2.59k stars 1.24k forks source link

program locked at `__lll_lock_wait_private` #5383

Open zxx8808 opened 2 years ago

zxx8808 commented 2 years ago

The call stack is as follows, I think it's because I use a timer( created using timer_create) in my program, so the program interlocks at the following two red boxes.

Instead of using a system timer, the approach I came up with is to get the current time and the last time. If their difference is greater than a certain value, then do the things I want to do. Maybe this timer is not very accurate.

Want to ask:

  1. Does open62541 support multi-thread now?
  2. Any suggestions?

image

Used CMake options:

cmake .. -DUA_ENABLE_AMALGAMATION=ON -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_NAMESPACE_ZERO=ON

Checklist

Please provide the following information:

zxx8808 commented 2 years ago

When I config the cmake option UA_MULTITHREADING=100, the program stops at an assertion ++(lock->mutexCounter) == 1.

The call stack below shows the two places where the mutex is locked at. I don't know why UA_LOCK(&server->serviceMutex) is already used in periodicServerRegister, UA_LOCK in __UA_Server_read can still go on to assert. Why isn't it stopped at pthread_mutex_lock(&lock->mutex)?

20221017-172859-812