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

Feature: Multithreading for Alarms & Conditions #4556

Open
1 of 7 tasks
basyskom-jvoe opened this issue Jul 26, 2021 · 4 comments
Open
1 of 7 tasks

Feature: Multithreading for Alarms & Conditions #4556

basyskom-jvoe opened this issue Jul 26, 2021 · 4 comments

Comments

@basyskom-jvoe
Copy link
Contributor

basyskom-jvoe commented Jul 26, 2021

When I attempt to trigger an event from inside activateSession(), the application is terminated due to the assertion in the UA_LOCK macro. The counter variable is already 1 at that point because UA_LOCK was already called in processMSGDecoded().

As the call is coming from the thread already holding the lock, shouldn't it be legal to acquire the lock again?

Please provide the following information:

  • open62541 Version (release number or git tag): v1.2.2
  • Other OPC UA SDKs used (client or server):
  • Operating system: Windows 10, MSVC 2013
  • Logs (with UA_LOGLEVEL set as low as necessary) attached
  • Wireshark network dump attached
  • Self-contained code example attached
  • Critical issue
@basyskom-jvoe
Copy link
Contributor Author

I can also trigger the locking asserts in the following scenario:

  • Enable Alarms & Conditions, set UA_MULTITHREADING to 100
  • The main thread runs UA_Server_run()
  • A second thread creates conditions
  • A client (e.g. UaExpert) calls ConditionRefresh

There are several places in the code where a function calls UA_UNLOCK() before calling some other function and then calls UA_LOCK() again after this function has returned. My guess is that the second thread could use one of these situations to sneak a lock in.

@jpfr
Copy link
Member

jpfr commented Aug 23, 2021

The problem in ActivateSession is fixed in #4609.
The Alarms&Conditions API currently does not have the UA_THREADSAFE tag.
So it makes no assurances being thread-safe.
We will refactor the locking behavior once we get there.

@jpfr jpfr changed the title UA_MULTITHREADING=100 and recursive locks Feature: Multithreading for Alarms & Conditions Aug 23, 2021
@jpfr
Copy link
Member

jpfr commented Aug 23, 2021

Adjusted the title as a reminder that A&C Multithreading is not yet done,

@xujiesh0510
Copy link

xujiesh0510 commented Mar 2, 2023

Adjusted the title as a reminder that A&C Multithreading is not yet done,

ConditionRefresh is good in master branch version. but confirm alarm、acknowledge alarm、 add comment still not ok

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

No branches or pull requests

3 participants