mdsplus
mdsplus copied to clipboard
TCL's "show current" command is not working with "thick-client"
Affiliation KFE - KSTAR Filed by @mwinkel-dev on behalf of @ahaglory (KSTAR) and @kgerickson (PPPL).
Version(s) Affected stable_release_7.132.0
Platform Rocky Linux 8.5
Describe the bug Receiving "Failed to get shotid" error message when using "show current" with thick-client.
To Reproduce
On Mon, Jan 8, 2024 at 21:30 Keith Erickson wrote:
Hi Mark,
See below for details, but basically, we'd like to be able to get the current shot as in the following:
$ export kstar_path=mdsw:8000::
$ mdstcl
TCL> show current kstar
Failed to get shotid.
But it only works like this:
$ export kstar_path=mdsw:8000::/mds/2023/KSTAR
$ mdstcl
TCL> show current kstar
Current shot is 33536
Expected behavior When using "show current" with thick-client, expect to receive the current shot id.
Screenshots N/A
Additional context Keith Erickson of PPPL is working with KSTAR, so submitted this KSTAR issue via email.
Cursory manual testing does reveal potential issues with TCL's show current and set current commands when using the thick-client (e.g. export some_tree_path=<server>::). And better behavior when using distributed access (e.g. export some_tree_path=<server>::<path>).
Uncertain though if this is "working as designed" (i.e., a design flaw) or if it is bug. Will discuss with other members of the software team to obtain the history of this feature. Probably will be a few more days before have a resolution to this issue.
A digression . . .
If use default_tree_path and it points to a directory containing many different types of trees (A, B, C, etc.), the "current shot" applies to all trees. There is a single shotid.sys file in the directory that holds a single number. Thus it is not possible to do set current A 100 and set current B 7777.
Hi @kgerickson and @ahaglory,
Was able to reproduce the show current issue. And found a problem with set current.
The show current issue probably indicates that the mdsip server is not fully configured. It is probably missing the "tree path" to the directory that contains the files.
For illustration, assume we have two servers: A and B. A has the "junk" tree files in /data_dir/junk. B is where the user is running mdstcl.
When B is configured to use "distributed" access (i.e., export junk_path="A::/data_dir/junk"), the path to the tree files is provided when B contacts A, and thus A is able to read the "current shot" from the /data_dir/junk/shotid.sys file.
However, when B is configured to use "thick-client" access (i.e., export junk_path=A::), B doesn't know where the trees are stored on A. Thus A must be configured to provide the path. For example, if using systemd to launch the mdsip service on A, one can achieve that by adding Environment="junk_path=/data_dir/junk" to the [email protected] file on A. And after making that change, it must of course be copied to /etc/systemd/system/[email protected] and a sudo systemctl daemon-reload should be done. (And if paranoid, reboot A.). Manual testing with two Rocky 9.3 VMs shows that when A is configured properly, that B can use "thick-client" to retrieve the current shot.
Note however that set current fails with thick-client -- even when properly configured. The following error is from the server B used to research this issue.
TCL> set current junk 600
Error: Unable to change current shot
Error message was: %TREE-E-FAILURE, Operation NOT successful
mdsdcl: --> failed on line 'set current junk 600'
TCL>
Note that there are several ways to set tree paths on mdsip servers. The most common way is probably to use the envsyms feature. Will post more on the topic tomorrow.
Hi I don't understand exactly the settings for server A. My MDSplus server provides services with tree path information in the '/usr/local/mdsplus/local/envsyms' file. Do I need to add additional path information for my mdsip service? "/etc/systemd/system/[email protected]"
This is my first time encountering the "/etc/systemd/system/[email protected]" file. Do I need to create the above file? Where can I find a description of the above settings?
Hi @ahaglory,
Thanks for the additional detail. Much appreciated.
When I did my experiments yesterday, I forgot to use envsyms -- which is the standard and recommended way to set tree paths. I will repeat my experiments this morning, but this time use envsysms. (If the mdsip service doesn't properly process envsyms, then that would be a software bug that needs to be fixed.)
Linux servers have two methods of starting services. The old style is with xinetd. The newer approach is to use systemd (which uses the mdsip@service file). If you've never seen the mdsip@service file, then your server is probably using xinetd.
Putting tree paths in the [email protected] file (if using systemd) is a non-standard approach. Don't make those changes at this time. Best to view the [email protected] approach as a temporary workaround if we can't get envsyms to work on your server. (There are probably even easier workarounds.)
I will do the envsyms experiments this morning, and post my findings here in two hours or so.
Hi @ahaglory,
On my Rocky 9.3 VM, I have experimented with envsyms and reproduced the error that you've seen with thick-client. Some initial debugging shows that the tree paths that mdsipd obtains from envsyms are not being passed to the actual service program, mdsip.
Investigation continues. I will post another update here later today.
Later Correction: Have proven that mdsip is indeed receiving the tree paths from mdsipd (which in turn uses setup.sh to get them from the envsyms file). However, the tree paths are obviously being dropped somewhere along the way, because unable to use thick-client to open any files in the tree directory. Now repeating the experiments on Ubuntu.
Hi @ahaglory,
Additional experiments confirm that mdisp can indeed use the tree paths from the $MDSPLUS_DIR/local/envsyms file. Use of envsyms is the recommended (and usual) way to specify tree paths.
However, it is important that the envsyms file be configured correctly. Using the example from several posts above, server A's envsyms file should be:
# This is good and works OK with mdsip
junk_path /data_dir/junk
Note that the environment variable is case sensitive. Thus the following envsyms file will fail.
# This is bad and will fail
JUNK_PATH /data_dir/junk
Please check the envsyms on your server and confirm that it is as per the first example above. Please post whether that fixes your show current problem or not.
Thanks,
-Mark
P.S. -- While experimenting with mdsip, some issues were found.
- The
set currentcommand doesn't work with thick-client. - A segfault occurs if ask for
show current <non-existent-tree>when there is nodefault_tree_path - Use of
default_tree_path(in addition to specific tree paths) works correctly, but can be confusing at first glance.
Hi @ahaglory,
Here is another simple test to determine if your mdsip server is configured correctly.
$ source $MDSPLUS_DIR/setup.sh
$ export kstar_path=mdsw:8000::
$ mdstcl
TCL> set tree kstar /shot=33536
TCL> dir
It should be able to open a tree using "thick-client" and show you the top-level nodes in the tree. If that doesn't work, then the show current won't work either. In which case, fiddle with the contents of the $MDSPLUS_DIR/local/envsyms so that you can open a tree using "thick-client". (Note: the example above uses values from the initial bug report, however you can use the shot number of any existing kstar tree.)
Hi @ahaglory and @kgerickson,
I am curious if this issue has been resolved. Did the advice in the following post solve the issue? https://github.com/MDSplus/mdsplus/issues/2684#issuecomment-1889957986
I can't modify the server side to test
Keith Erickson Cell: Office:
On Thu, Feb 8, 2024 at 7:04 PM mwinkel-dev @.***> wrote:
Hi @ahaglory https://github.com/ahaglory and @kgerickson https://github.com/kgerickson,
I am curious if this issue has been resolved. Did the advice in the following post solve the issue? #2684 (comment) https://github.com/MDSplus/mdsplus/issues/2684#issuecomment-1889957986
— Reply to this email directly, view it on GitHub https://github.com/MDSplus/mdsplus/issues/2684#issuecomment-1935120344, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADL6D6U5HHSGNNAWLSSC4I3YSVRZRAVCNFSM6AAAAABBW23KYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVGEZDAMZUGQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi @ahaglory and @kgerickson,
I am curious if this issue has been resolved. Did the suggestions made on 12-Jan-2024 (third and fourth posts that day) fix the issue?
Thanks,
-MarkW
I was very busy with work so I wasn't able to test it right away.
In kstar, tree names are all lowercase. (ex (/usr/local/mdsplus/local/envsyms): kstar_path "/mds/2023/KSTAR/;/mds/2022/KSTAR/"
I tested as attached. If I execute the 'show currnet kstar' command at once, I get 'failed to get shotid'. However, if you enter 'show current' and _Experiment: 'kstar' separately, the shotid is retrieved successfully.
(Test on the client system)
Error
TCL> show current kstar Failed to get shotid
Success case 1
TCL>show current _Experiment: kstar Current shot is 34534
#Success case 2 TCL> set tree kstar/shot=34555 TCL>dir => display top-level nodes TCL>show current kstar Current shot is 34534
Hi @ahaglory,
Thank you for the additional information. I will now install stable-7.132.0 and see if I can reproduce the problem.
Hi @ahaglory and @kgerickson,
Conjecture: cherry-picking PRs #2526 and #2533 to stable will likely fix this issue.
Now for the details . . .
My initial experiments have been with current alpha (just because it was already installed on my development computers). And I have been unable to reproduce the problem, even though extensive testing has been done.
So before installing stable, I checked the commit history of the two branches.
KSTAR is using stable_release-7.132.0 which was released on 15-Dec-2022. And on 1-Feb-2023, PR #2526 was merged to alpha. (That PR mentions that show current doesn't work with thick-client). Plus an additional correction was made with PR #2533 on 13-Feb-2023.
Tomorrow, I will do an experimental build of current stable plus cherry-picks of those two PRs to see if that fixes this KSTAR issue.
With @ahaglory 's additional information, was able to reproduce this bug using stable.
And also confirmed again that the bug does not exist in alpha. So now the task is to figure out which commits in alpha fixed the problem.
That's good news~ thanks.
Hi @ahaglory and @kgerickson,
This bug is a duplicate of PR #2418. Experiments confirmed that it is the essential cherry-pick needed for the stable branch.
PRs #2526 and #2533 are optional, but likely useful for KSTAR and other sites that use thick-client.
Have contacted Keith to determine if this issue can be closed.