While testing Tango9 on Debian9 I discovered that PyPLC (a python device server using a Modbus C++ device to connect to PLC devices) triggered an “omni_thread fatal exception” error (and a coredump) when killing the device.
Further debugging the issue I’ve made disappear the exception just adding a “del” call in the delete_device method:
def init_device(self):
...
self.modbus = PyTango.DeviceProxy(self.ModbusDeviceName)
...
def delete_device(self):
# Needed to avoid coredump on exit
del self.modbus
This issue is completely new in PyTango 9.2 and I haven’t seen it with the same device in PyTango 9.1, 8 or 7.
Are anyone having the same problem or do you always delete proxies on exit?
I cannot reproduce your issue with pytango-9.2.1. Could you try the following code:
from tango.server import Device
from tango import DeviceProxy, DevState
from tango.test_context import DeviceTestContext
class TestDevice(Device):
def init_device(self):
self.proxy = DeviceProxy('sys/tg_test/1')
def dev_state(self):
return self.proxy.state()
def test_device():
with DeviceTestContext(TestDevice) as proxy:
assert proxy.state() in (DevState.RUNNING, DevState.FAULT)
if __name__ == '__main__':
test_device()
On PyTango-9.2.0 I miss the tango.test_context module. Anyway, my case could be harder to reproduce as I’m using asynchronous commands on a background thread.
I’m going to update PyTango and check if the error persists.