unsubscribe_event fails in delete_device

Hi,

In a high level DS I subscribe to multiple events/low level DS.
I call subscribe_event in init_device and unsubscribe_event in delete_device.

In init_device:

eventid = self._device.subscribe_event("XXX", PyTango.EventType.CHANGE_EVENT, self._callback, stateless=False)
self._eventids.append(eventid)
eventid = self._device.subscribe_event("YYY", PyTango.EventType.CHANGE_EVENT, self._callback, stateless=False)
self._eventids.append(eventid)

In delete_device:

for eventid in self._eventids:
self._device.unsubscribe_event(eventid)

The fellowing error appears everytimes during delete_device execution:

DevError[
desc = Failed to disconnect from event!
Error while trying to unsubscribe the heartbeat ZMQ socket from the channel heartbeat publisher
ZMQ message: No such file or directory
origin = ZmqEventConsumer::disconnect_event
reason = API_ZmqFailed
severity = ERR]
]'

After several restarts the fellowing error appears during init_device execution:

DevError[
desc = Failed to delay event!
Error while communicating with the ZMQ main thread
ZMQ message: Connection refused
origin = DelayEvent::DelayEvent
reason = API_ZmqFailed
severity = ERR]
]

Im using PyTango 8.1.6, Tango 8.1.2c

Best regards,

Philippe
Hi Philippe,

We've been using similar devices for a while and your code looks fine, so I assume it is a configuration issue.

My first guess would be something about the tango host. ZMQ events can be a bit picky about it since it includes the host name inside the channel name. For instance, I had similar problems when I used an IP address as a tango host.

Also, is your callback called when the device is running? Do you get the 'Event channel not responding anymore' DevError?

Some more information about your config could help as well (OS and zeromq version).
Edited 8 years ago
Hi Vincent,

Thanks a lot for a so quick answer.

First of all, here is the environment I use :
Windows 7
PyTango 8.1.6
Tango 8.1.2b
libzmq 4.0.4
pyzmq 14.4.1

My TANGO_HOST was effectively 127.0.0.1. I changed to localhost, it is the same problem.
Here is the code I use to test the execution of delete_device :
import PyTango
dev = PyTango.DeviceProxy("ZZZ")
adm = PyTango.DeviceProxy(dev.adm_name())
adm.Kill()

When the High level DS is running and I stop a Low level DS, the callback associated with this DS report "'Event channel not responding anymore' DevError" as you mentionned. When I restart the Low level DS, the callback is called again, that's fine !

Best Regards

Philippe

Hi Philippe,

Sorry for the late answer.

If I understand correctly, your event channel works fine until your try to unsubscribe, is that it?

There are other (and easier) ways to test your delete_device method:
- Run the INIT command: it will successively call delete_device and init_device on your device object
- Send a keyboard interruption to the device server

Let me know if you get different results using those approaches.

Cheers
I'm having a similar problem here, with PyTango 8.1.8. The problem occurs only when a server is running more than one device. The INIT command seems to work properly in both the devices that are running on the same server, but if I kill the process with a keyboard interruption, then I get the

Failed to disconnect from event!
Error while trying to unsubscribe the heartbeat ZMQ socket from the channel heartbeat publisher
ZMQ message: No such file or directory

error. In this case I have to press CTRL+C several times, and at the end I get a segmentation fault here:

#0 0x00007f6867101b98 in set_svr_shutting_down (this=0x1db1690) at ../../../../lib/cpp/server/utils.h:893
#1 Tango::Util::shutdown_server (this=0x1db1690) at ../../../../lib/cpp/server/utils_shut.cpp:79
#2 0x00007f68670f0175 in Tango::DServerSignal::ThSig::run_undetached (this=0x1ddf510, ptr=<value optimized out>) at ../../../../lib/cpp/server/thsig.cpp:202
#3 0x00007f6865936e7e in omni_thread_wrapper () from /virgo/ext/omniORB/omniORB-4.1.4/Linux-x86_64-SL6/lib/libomnithread.so.3
#4 0x000000379dc07a51 in start_thread () from /lib64/libpthread.so.0
#5 0x000000379d0e896d in clone () from /lib64/libc.so.6

In case of a single device server, I don't have any problem.

Please note that in both cases the events work properly: I have problems only when trying to kill the multi-device servers.
 
Register or login to create to post a reply.