MDSplus / mdsplus

The MDSplus data management system
https://mdsplus.org/
Other
75 stars 45 forks source link

Accessing tree info after tree has been externally recreated results in SIGBUS #2834

Open merlea opened 4 days ago

merlea commented 4 days ago

Affiliation SPC-EPFL

Version(s) Affected Stable 7.142.81

Platform(s) Ubuntu 24.04

Installation Method(s) Official DEB repository

Describe the bug If a tree is open in process 1 and process 2 replaces this tree with a new copy, then reopening the tree in process 1 results in a SIGBUS error.

To Reproduce Steps to reproduce the behavior:

  1. Open a terminal set default_tree_path=/tmp and execute mdstcl and the following commands
    TCL> edit test/shot=1 /new
    TCL> write
    TCL> close
  2. Open another terminal set default_tree_path=/tmp and execute tdic
    TDI> TreeOpen("test",1)

    Leave the tdic session open.

  3. Go back to the original terminal of step 1 and repeat step 1
  4. Go back to the terminal of step 2 and try to open the tree again
    TDI> TreeOpen("test",1)
  5. tdic crashes with SIGBUS error

Expected behavior No crash, maybe an error message explaining that the db entry seems to not be valid anymore and should be closed, or close the tree silently and continue with the user input.

joshStillerman commented 3 days ago

This is 'known behavior'. You can not edit a tree that is open. We should (to the extent we can) notice that this is going on, and either prevent the tree from being edited since it is open, or as noted in the issue, warn the user.

I am not sure either of these is doable

joshStillerman commented 3 days ago

The TreeEstablishRundownEvent which was probably for this purpose, is not implemented. It is in treeshr/dummy.c