astropy icon indicating copy to clipboard operation
astropy copied to clipboard

chaining of exceptions using samp_hub

Open mbec-lbto opened this issue 6 months ago • 3 comments

Description

SAMP clients issuing blocking commands (ecall_and_wait with timeout=0) do not get notified of peer exception.

Expected behavior

ecall_and_wait should raise an exception back to the client when the peer dies

How to Reproduce

It is a little bit convoluted do to the distributed nature of the issue.

  1. start a samp_hub with a well know SAMP_HUB file
samp_hub -f $HOME/.samp_demo
  1. start our peer (here, ds9), using the hub
export SAMP_HUB=std-lockurl:file://$HOME/.samp_demo
ds9 -samp hub no -samp client yes -title myds9
  1. start our astropy samp client
export SAMP_HUB=std-lockurl:file://$HOME/.samp_demo

and start python

from astropy.samp import SAMPIntegratedClient
s = SAMPIntegratedClient()
s.connect()
s.get_subscribed_clients('ds9.set')
# gives {'cli#1': {}}

# sanity check (ok)
s.ecall_and_wait('cli#1', 'ds9.get', '0', cmd='version')
# gives {'samp.result': {'value': 'myds9 8.7b1'}, 'samp.status': 'samp.ok'} 

# issue a blocking command
s.ecall_and_wait('cli#1', 'ds9.get', '0', cmd='iexam key coordinate')
# (this waits for the user to press a key on ds9 for coordinates)
  • kill the ds9 instance (window)
  • our python client is still stuck in ecall_and_wait

this only happens when using samp_hub. If one connects SAMPIntegratedClient directly to the built-in ds9 samp hub (ds9 -samp hub yes, on ds9 window kill, the exceptions are correctly propagated back to the client.

Versions

import astropy
astropy.system_info()
astropy.version.version
AttributeError: module 'astropy' has no attribute 'system_info'
'5.3.3'

mbec-lbto avatar May 30 '25 19:05 mbec-lbto

BTW astropy 5.3 is very old. Try upgrading. Even so, astropy.samp does not really change, so this might still be an issue.

pllim avatar May 30 '25 19:05 pllim

I get the same result using conda 3.12 / astropy 7.1.0 tbh it might not be an issue with astropy.samp, but the SAMP protocol or underlying XML-RPC. iirc the only way to really know a TCP/IP connection is alive is having some off-band traffic. This is not really critical but I thought I'd report it, it came as a surprise.

mbec-lbto avatar May 30 '25 19:05 mbec-lbto

pure conjuncture, but since client <-> ds9 appears to detect it, maybe something in client <-> samp_hub <-> ds9 is not chained back properly.

mbec-lbto avatar May 30 '25 19:05 mbec-lbto