python-opcua icon indicating copy to clipboard operation
python-opcua copied to clipboard

`_not_acknowledged_results` leaks memory

Open guillaumeautran opened this issue 4 years ago • 0 comments

Running python3-opcua==0.98.9-1 we are running into a memory leak problem where the _not_acknowledged_results list grows unbounded. The condition occurs when the OPCUA Keep-Alive Interval and the OPCUA Keep-Alive Timeout are set to 500ms.

The problem is that the dictionary declared here: https://github.com/FreeOpcUa/python-opcua/blob/master/opcua/server/internal_subscription.py#L263 has items appended here: https://github.com/FreeOpcUa/python-opcua/blob/master/opcua/server/internal_subscription.py#L334 But the dictionary does not get cleared from here: https://github.com/FreeOpcUa/python-opcua/blob/master/opcua/server/internal_subscription.py#L372 or here : https://github.com/FreeOpcUa/python-opcua/blob/master/opcua/server/internal_subscription.py#L367

Here: https://github.com/FreeOpcUa/python-opcua/blob/583d970bed30b44236418e03b5a6ff6fea481b13/opcua/server/subscription_service.py#L70-L74 is where is should logically be happening (the publication of the ack).

The result is that the dictionary grows unbounded consuming all of the memory of the host.

guillaumeautran avatar Nov 17 '20 20:11 guillaumeautran