Open aklira opened 3 months ago
I'm sorry, but I cannot reproduce the problem.
Could you please provide more details? Specifically, how did you install or build c104? Additionally, how do you execute the script? What python version and OS (arm,linux,mac,windows and 32/64bit) are you using?
Hi,
I've made the installation following the instructions provided on the Readme:
python3 -m pip install c104
I've executed the script on Ubuntu 20.04 VM, x86_64 architecture with python 3.10.
I was able to reproduce the issue. It occurs during the server shutdown procedure. Your client seems to be disconnected, and the simple_server.py script quits after the disconnection. Consequently, the Python garbage collector will free the objects - BUT in a non-optimal order. The simple fix is to add a server.stop() command after the last while loop.
--- a/examples/simple_server.py
+++ b/examples/simple_server.py
@@ -55,6 +55,8 @@ def main():
print("Keep alive until disconnected")
time.sleep(1)
+ server.stop()
+
if __name__ == "__main__":
c104.set_debug_mode(c104.Debug.Server)
Impact The automatic shutdown procedure is not as clean as it should be, but it should be safe to use the library with the stop command. The error should never occur unless the Python garbage collector is about to free the server instance.
Can you confirm that?
If you wish to, you can verify the fix via installing from source branch:
pip install git+https://github.com/Fraunhofer-FIT-DIEN/iec104-python.git@dev
The fix will be included in the upcoming release.
Release 2.0.0 is now available, and it includes the fix that addresses this issue. I would greatly appreciate your feedback. If the issue is resolved to your satisfaction, please consider closing this thread.
Thank you!
Hi, I am experiencing an issue with the examples/simple_server.py: After a short time (few seconds) the iec104 server would crash with the following error: terminate called after throwing an instance of 'std::bad_weak_ptr'
Here is the full log of the server instance: