Exceptions on killing a device that access other devices


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?

Sergi - ALBA

Keep on dancing,

Edited 8 months ago
Hi Sergi,

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__':

Hi Vincent,

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.

Keep on dancing,

On PyTango-9.2.0 I miss the tango.test_context module

If you want to run the test with pytango-9.2.0, you can declare a new device in the database and run this code instead:

if __name__ == '__main__':

Anyway, my case could be harder to reproduce as I'm using asynchronous commands on a background thread.

Yes that is likely to be related. You can report the issue on the pytango tracker once you managed to reproduce it.

Edited 8 months ago
Register or login to create to post a reply.