zoukankan      html  css  js  c++  java
  • OPCUA suscription TimeoutError

    在OPCUA 中订阅某个结点值是否有变化,并做出相应处理。启动新线程去读取OPCUA结点值,出现以下错误:

    Exception in thread Thread-3:
    Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
    File "/Users/tonyyan/Documents/HamerOPCUA/Hamer_implementation/client.py", line 66, in show_new_values
    code = self.PosObj.get_child(["{}:Code".format(self.idx)])
    File "/Users/tonyyan/Documents/HamerOPCUA/venv/lib/python2.7/site-packages/opcua/common/node.py", line 471, in get_child
    result = self.server.translate_browsepaths_to_nodeids([bpath])
    File "/Users/tonyyan/Documents/HamerOPCUA/venv/lib/python2.7/site-packages/opcua/client/ua_client.py", line 427, in translate_browsepaths_to_nodeids
    data = self._uasocket.send_request(request)
    File "/Users/tonyyan/Documents/HamerOPCUA/venv/lib/python2.7/site-packages/opcua/client/ua_client.py", line 83, in send_request
    data = future.result(self.timeout)
    File "/Users/tonyyan/Documents/HamerOPCUA/venv/lib/python2.7/site-packages/concurrent/futures/_base.py", line 464, in result
    raise TimeoutError()
    TimeoutError

    解决方法: 去除线程后面的join

    t = Thread(target=self.show_new_values)
                t.start()
                t.join(5)
                t = Thread(target=self.show_new_values)
                t.start()
                # t.join(5)

    猜测原因:

    并发死锁:

    https://rednafi.github.io/digressions/python/2020/04/21/python-concurrent-futures.html

  • 相关阅读:
    centos下两种方法安装git
    Field.setAccessible()方法
    Tomcat日志格式自定义
    Java监控工具
    JDK目录结构和文件作用介绍
    Java中堆和栈的区别
    Magicodes.WeiChat——使用AntiXssAttribute阻止XSS(跨站脚本攻击)攻击
    Magicodes.WeiChat——缓存管理
    Magicodes.WeiChat——WeChatOAuthTest(网页授权获取用户基本信息)
    Magicodes.WeiChat——后台JS框架封装
  • 原文地址:https://www.cnblogs.com/mrlonely2018/p/15380810.html
Copyright © 2011-2022 走看看