PaulHancock / Aegean

The Aegean source finding program and associated tools
http://aegeantools.rtfd.io/
Other
47 stars 14 forks source link

Running 2+ concurrent versions of BANE can cause a crash #189

Closed PaulHancock closed 2 years ago

PaulHancock commented 2 years ago

Here is a minimal example of how to cause this problem:

> BANE 1904-66_SIN.fits & BANE 1904-66_AIT.fits &
[1] 2437243
[2] 2437244
2437244:INFO This is BANE v1.10.0-(2022-08-17)
2437244:INFO using grid_size (15, 15), box_size (90, 90)
2437244:INFO on data shape (192, 192)
2437244:INFO using 8 cores
2437244:INFO using 8 stripes
2437243:INFO This is BANE v1.10.0-(2022-08-17)
2437243:INFO using grid_size (15, 15), box_size (90, 90)
2437243:INFO on data shape (192, 192)
2437243:INFO using 8 cores
2437243:INFO using 8 stripes
Traceback (most recent call last):
  File "/data/alpha/hancock/Aegean/AegeanTools/BANE.py", line 365, in filter_mc_sharemem
    ibkg = SharedMemory(name='ibkg', create=True, size=nbytes)
  File "/usr/lib/python3.8/multiprocessing/shared_memory.py", line 102, in __init__
    self._fd = _posixshmem.shm_open(
FileExistsError: [Errno 17] File exists: '/ibkg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paulhancock/.py3-aegean/bin/BANE", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/data/alpha/hancock/Aegean/scripts/BANE", line 9, in <module>
    sys.exit(BANE.main(sys.argv[1:]))
  File "/data/alpha/hancock/Aegean/AegeanTools/CLI/BANE.py", line 87, in main
    BANE.filter_image(im_name=options.image, out_base=options.out_base,
  File "/data/alpha/hancock/Aegean/AegeanTools/BANE.py", line 487, in filter_image
    bkg, rms = filter_mc_sharemem(im_name,
  File "/data/alpha/hancock/Aegean/AegeanTools/BANE.py", line 393, in filter_mc_sharemem
    ibkg.close()
UnboundLocalError: local variable 'ibkg' referenced before assignment

It seems that the first program will run without error, even though the other one crashes.