Skip to content

Commit 2476bb6

Browse files
committed
Delete datachange_callbacks only on copy of dict to delete them from
Deleting a node on which any client holds a datachange-notification subscription, NodeManagementService._delete_node_callbacks fails because the size of the dictionary it loops over changes. Here, we solve this by not using the .items() iterator, but making a copy in form of a list first ….
1 parent 4375525 commit 2476bb6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

opcua/server/address_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def _delete_node(self, item, user):
330330

331331
def _delete_node_callbacks(self, nodedata):
332332
if ua.AttributeIds.Value in nodedata.attributes:
333-
for handle, callback in nodedata.attributes[ua.AttributeIds.Value].datachange_callbacks.items():
333+
for handle, callback in list(nodedata.attributes[ua.AttributeIds.Value].datachange_callbacks.items()):
334334
try:
335335
callback(handle, None, ua.StatusCode(ua.StatusCodes.BadNodeIdUnknown))
336336
self._aspace.delete_datachange_callback(handle)

0 commit comments

Comments
 (0)