ericmandel / pyds9

Python connection to SAOimage DS9 via XPA
76 stars 41 forks source link

Resource exhastion? #68

Closed pkubanek closed 6 years ago

pkubanek commented 6 years ago

After thousands times creating regions with group tag, and then deleting them, I got the following backtrace:

petr@kubanekp-ntb:~/rts2/python$ ./rts2-shiftautofoc -p ../checks/data/0108.FOCUS.fits XPA client connect: Cannot assign requested address Traceback (most recent call last): File "./rts2-shiftautofoc", line 37, in sc.run_on_image(f.name, None, True) File "/home/petr/rts2/python/rts2/shiftstore.py", line 319, in run_on_image b = self.find_row_objects(x, partial_len) File "/home/petr/rts2/python/rts2/shiftstore.py", line 248, in find_row_objects ret = self.test_objects(x, can, i, otherc, partial_len) File "/home/petr/rts2/python/rts2/shiftstore.py", line 144, in test_objects 'point=box 20 color=yellow tag={can}' File "/home/petr/rts2/python/rts2/shiftstore.py", line 101, in plot_point plot(x[i], y[i], args) File "/home/petr/rts2/python/rts2/shiftstore.py", line 94, in plot 'physical; point {0} {1} # {2}'.format(x, y, args) File "/home/petr/.local/lib/python3.6/site-packages/pyds9.py", line 578, in set s, blen, 1) File "/home/petr/.local/lib/python3.6/site-packages/xpa.py", line 173, in xpaset raise ValueError(errmsg) ValueError: XPA$ERROR: can't connect to data chan (?:?)

That point probably to resource exhaustion?

ericmandel commented 6 years ago

Yes, it’s likely that you ran out of sockets. You can check by running:

netstat -an

I suspect you’ll see thousands of sockets in the TIME_WAIT state, which is a delay between the time a socket is closed and when it really disappears and can be reused.

Obviously if you can batch the creation and deletion you can put off the time when you will run out ...

On Sun, Jul 22, 2018 at 10:43 PM Petr Kubánek notifications@github.com wrote:

After thousands times creating regions with group tag, and then deleting them, I got the following backtrace:

petr@kubanekp-ntb:~/rts2/python$ ./rts2-shiftautofoc -p ../checks/data/0108.FOCUS.fits XPA client connect: Cannot assign requested address Traceback (most recent call last): File "./rts2-shiftautofoc", line 37, in sc.run_on_image(f.name, None, True) File "/home/petr/rts2/python/rts2/shiftstore.py", line 319, in run_on_image b = self.find_row_objects(x, partial_len) File "/home/petr/rts2/python/rts2/shiftstore.py", line 248, in find_row_objects ret = self.test_objects(x, can, i, otherc, partial_len) File "/home/petr/rts2/python/rts2/shiftstore.py", line 144, in test_objects 'point=box 20 color=yellow tag={can}' File "/home/petr/rts2/python/rts2/shiftstore.py", line 101, in plot_point plot(x[i], y[i], args) File "/home/petr/rts2/python/rts2/shiftstore.py", line 94, in plot 'physical; point {0} {1} # {2}'.format(x, y, args) File "/home/petr/.local/lib/python3.6/site-packages/pyds9.py", line 578, in set s, blen, 1) File "/home/petr/.local/lib/python3.6/site-packages/xpa.py", line 173, in xpaset raise ValueError(errmsg) ValueError: XPA$ERROR: can't connect to data chan (?:?)

That point probably to resource exhaustion?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ericmandel/pyds9/issues/68, or mute the thread https://github.com/notifications/unsubscribe-auth/AC43i0jh56BtOJTEhMUBEbivmPo7o4ppks5uJThrgaJpZM4VaSFf .

pkubanek commented 6 years ago

That was it. It should be probably noted in the doc that this is legal and will work:

d=pyds9.DS9() regions=['physical; point 10 20 # color=yellow', 'physical; point 30 40 # color=red'] d.set('regions', '\n'.join(regions))