Motor controller config update event creates a fault in other beacon client
Hi,
In certain situations of BlissAxisManger client start/shudown, an exception is triggered in other beacon client(s):
Unhandled exception in thread started by <function receive_channels_values at 0x7f50540ddaa0>
Traceback (most recent call last):
File "/users/blissadm/python/bliss_modules/bliss/config/channels.py", line 106, in receive_channels_values
channel_name, value = cPickle.loads(val)
File "/users/blissadm/python/bliss_modules/bliss/config/static.py", line 80, in __init__
self._config = weakref.ref(config)
TypeError: ("cannot create weak reference to 'tuple' object", <class 'bliss.config.static.Node'>, ((), 0, 0))
By tracing down the issue, the problem seems to be in the update of a motor controller config/setting/channel, which creates an event that includes the corresponding cPickle serialisation. The config object itself is converted to a dictionary:
def _update_channel(self):
if self.config_channel is not None:
# inform all clients that config has changed
self.config_channel.value = dict(self.config_dict)
but the underlying axes
config elements are still of type <bliss.config.static.Node>
. When the event is received by the client it tries to unpickle the original axis config nodes. The constructor fails because it's first parameter 'config' receives an empty tuple, which cannot be weakref'ed. This is problem is very simple to simulate (@bibhelm) through the code:
from bliss.config.static import get_config
config = get_config()
c_sim_chi_tilt = config.get_config('sim_chi_tilt')
d_sim_chi_tilt = dict(c_sim_chi_tilt)
import cPickle
s = cPickle.dumps(d_sim_chi_tilt)
cPickle.loads(s)