1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Version 17 Installer Leaves Multiple Copies of ShrAlias

Discussion in 'Support' started by Jay Sage, Nov 10, 2014.

  1. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    I have found that after installing updates there are multiple copies of ShrAlias running (I have seen as many as three).

    -- Jay
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    The installer does not start SHRALIAS. You're probably starting it in your TCSTART.
     
  3. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    My TCSTART file starts ShrAlias only if it is not already running. There is a test of _shralias; ShrAlias is run only if the value is zero.

    During the installation process, there is a screen that reports that ShrAlias is running and says that it will be turned off and then restored once the installation is complete. Something is going wrong in the process. Perhaps the installer is not shutting it down, but the value of _shralias is still 0.

    Running the command ShrAlias cannot start a second copy; it reports that ShrAlias is already running.

    I can try to watch more carefully at the next update.

    -- Jay
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    If the installer couldn't stop it, it couldn't install a new file. I suspect that would generate an error message.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    Unless you're installing in different directories every time, you cannot have multiple live copies of SHRALIAS running. Maybe a couple of zombie processes that Windows failed to shut down properly -- but that would be a question for Microsoft.

    There were no changes to SHRALIAS for v17.
     
  6. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    What you say may be fine in principle, but it happened again!

    I just updated to build 50. The screen came up advising me that "Some files that need to be updated are currently in use". I allow the installer to "Automatically close applications and attempt to restart them after setup is complete". Then I select the option to run TCMD at the end of the install.

    TCMD starts up with TCC in tab 1. It shows the following output generated by TCSTART:

    TCC 17.00.50 x64 Windows 7 [Version 6.1.7601]
    TCC Build 50 Windows 7 Build 7601 Service Pack 1

    Running C:\tcmd\ver17\TCSTART.btm

    No need to load SHRALIAS. It is already running.​

    When I then run TASKLIST, it shows two ShrAlias tasks running:

    PID Program Window Name
    --- -------------- ----------------
    6796 ShrAlias ShrAliasWindow
    4388 ShrAlias ShrAliasWindow


    The copy with PID 4388 is using 204K of memory; PID 6796 is using 220K. Neither has used any CPU time. I don't know how to learn any more about them.

    After I run SHRALIAS /U, only PID 4388 remains. To prevent any trouble, I run SHRALIAS /U again to kill the remaining one and then run SHRALIAS afresh to get it running again. After that, I have PID 7380 using 188K.

    -- Jay
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    I'll pass it on to Microsoft (it's their code), but I doubt you'll see a fix anytime soon.

    I have no problems shutting down SHRALIAS here.
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    Does the installer offer to restart SHRALIAS? That doesn't seem right. I wouldn't expect SHRALIAS to find any memory mapped files to guard if it wasn't started by TCC.
     
  9. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    Here is the screen that is shown. It claims to be the "Advanced Installer".

    -- Jay

    upload_2014-11-10_17-2-48.png
     

    Attached Files:

  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    As I said, it seems silly for anything but TCC to start SHRALIAS. If fact, I wouldn't expect SHRALIAS to keep running if it weren't started by TCC. Could that be the problem ... the installer restarts it and it stays running (when it shouldn't)?
     
  11. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    This is something that I have never seen happen with previous versions of Take Command.

    I have an alias called "update" that calls "option /u". I have now added code to unload ShrAlias first.
     
  12. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    Well, even though I had shut down ShrAlias before updating, after updating to build 51 and launching TCMD, there were two copies of ShrAlias running. Now, I did not discover this until after opening some additional tabs, so I don't know that two copies appeared immediately.
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    Q: Were any there after the install but before you launched anything?
     
  14. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    I don't know when they appeared. Now that I have seen this even after I at least thought that I had shut down all copies of ShrAlias before updating to the new build, I will try to remember to watch very carefully at the next update. Perhaps there had been three copies before I ran ShrAlias /u in my update alias. The installer did not report that ShrAlias was running and ask me if it should shut it down. So, if there were copies running, they were not visible to the installer. This is all very bizarre.
     
  15. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    I haven't seen this problem and I update versions pretty frequently. The installer always prompts to shut down shralias, which I let it do. First launch of TCMD after installation restarts sharalias (tcstart.btm starts it if it's not already running). Never had an issue with multiple instances.
     
  16. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    Jay, how many startup (TCC) tabs do you have defined? If one tries to start SHRALIAS too soon after another does, the second one won't be able to figure out that SHRALIAS is already running. It's quite easy to start two instances of SHRALIAS if you do it quick enough.
    Code:
    v:\> shralias & shralias
    SHRALIAS loaded
    SHRALIAS loaded
    
    v:\> tasklist | grep -i shra
      5504  ShrAlias  ShrAliasWindow
      4516  ShrAlias  ShrAliasWindow
    Also, for the same reason:
    Code:
    v:\> shralias &  echo %_shralias
    SHRALIAS loaded
    0
     
  17. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    And I suppose that could also happen with only one TCC if TCSTART.BTM caused a transient/pipe instance of TCC to be started.
     
  18. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    TCMD starts only one TCC tab, which launches ShrAlias if it is not already running. Also, I never had this problem before version 17, and my configuration has not changed in any substantive way. As I wrote earlier, I will try to remember to watch things very carefully with future updates.
     
  19. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,288
    Likes Received:
    39
    Hmmm.... Perhaps Take Command should have an option to automatically start SHRALIAS before any tab windows?
     
  20. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    Maybe you could do your SHRALIAS check/load only if %_TCTABACTIVE = 1. If you are starting multiple TCC tabs on TCMD startup, only the first (active) tab would do the work.
     
  21. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    I'm thinking something like this for tccstart.btm. (It would need to be adjusted if you ever run TCC outside of TCMD though.)

    Code:
    @echo off
    
    if %_pipe == 1 .or. %_transient == 1 quit
    
    iff %_shralias == 0 .and. %_tctabactive == 1 then
      shralias
    
      history /r    "%@path[%@full[%0]]cmdhist.txt"
      dirhistory /r "%@path[%@full[%0]]dirhist.txt"
      alias /r      "%@path[%@full[%0]]aliases.txt"
      function /r   "%@path[%@full[%0]]functions.txt"
    
      alias desk:=%@shfolder[0]
      alias docs:=%@shfolder[5]
      alias drop:=%USERPROFILE%\Dropbox
    endiff
    
    ...
    ...
     
  22. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    It's a matter of timing, so it being one way in one version and another way in another version is not a conclusive argument that something's wrong. IIRC, the check for a running SHRALIAS is a check for the existence of a window; if the check is made too soon, the window won't exist. Jay, does your TCSTARY cause any transient or pipe instances of TCC to be started? If so, check for that in TCSTART as in Rod's example.

    A better solution ... put all that loading of the lists and starting SHRALIAS in its own BTM and put it in the startup folder or run it at logon via a task. That'd avoid unnecessary stuff every time you start TCC. I have a BTM hat runs at logon and does several things that need to be done only once. Among them is:
    Code:
    cdd %SHRALIAS_SAVE_PATH
    do c in /L history dirhistory alias function ( %c /r %c.sav )
    shralias
    delay 2
     
  23. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    My TCSTART file does check at the beginning to see if it is running in a transient or pipe, and it skips right out in those cases. I don't think this is a timing issue on my system. ShrAlias gets started only when the first tab of TCMD opens during boot up of my computer.
     
  24. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    I think there's only two ways to get more than one SHRALIAS running at the same time.
    1. call SHRALIAS.EXE directly (which I doubt is being done)
    2. call the internal SHRALIAS more than once in rapid succession
     
  25. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    When updating just now to build 52, I used the Task Manager to keep track of the ShrAlias copies running. I purposely left it running in TCC before I issued the command "option /u". When I got to the point in the installation process where I was asked about automatically closing it and then restarting, the installer shut it down.

    Later when I clicked on the option to run Take Command now, at the point when the registration prompt came up, two copies of ShrAlias started running, as shown in the following screen capture.

    upload_2014-11-13_6-23-7.png

    After clicking "Continue", TCMD started and ran TCC in one tab. It showed the following:

    TCC 17.00.52 x64 Windows 7 [Version 6.1.7601]
    TCC Build 52 Windows 7 Build 7601 Service Pack 1

    Running C:\tcmd\ver17\TCSTART.btm

    No need to load SHRALIAS. It is already running.

    TCSTART saw that ShrAlias was already running and did not try to load it again. Unloading it went as follows:

    TCC(17.00.52): C:\Users\Jay\DOCUME~1\mydrop~1>shralias /u
    SHRALIAS unloaded

    TCC(17.00.52): C:\Users\Jay\DOCUME~1\mydrop~1>shralias /u
    SHRALIAS unloaded

    TCC(17.00.52): C:\Users\Jay\DOCUME~1\mydrop~1>shralias /u
    SHRALIAS not loaded

    That got rid of the two copies. Starting a second TCC tab produced the following, as expected:

    TCC 17.00.52 x64 Windows 7 [Version 6.1.7601]
    TCC Build 52 Windows 7 Build 7601 Service Pack 1

    Running C:\tcmd\ver17\TCSTART.btm

    Loading SHRALIAS
    SHRALIAS loaded

    set /r c:\tcmd\ver17\env.cfg
    alias /r c:\tcmd\ver17\diralias.cfg
    alias /r c:\tcmd\ver17\alias.cfg
    function /r c:\tcmd\ver17\function.cfg
     

    Attached Files:

  26. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    Good detective work, Jay. That's pretty definitive. Rex will probably figure out what's happening.

    Curious ... did you notice if TWO TCCs were started (to handle the registration dialog, before TCMD)?
     
  27. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    I did not notice any TCC sessions sessions before TCMD opened and my one tab loaded. If Rex is running TCC sessions to finish the install, they should do something to avoid using the user's INI file and certainly the TCSTART script. I also don't know why more than one instance of TCC would be used (but, then again, I don't really have much of an idea about what happens during the installation).
     
  28. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    TCC is not used at all during installation. (Nor is TCMD, IDE, or SHRALIAS.)
     
  29. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    So what is happening in the installer to kill and then reload ShrAlias? All I'm doing is running the installer. ShrAlias was gone before I clicked the button to start Take Command, and the two copies appeared before the registration screen came up.

    Is there anything else you want me to look at during the update process (e.g., whether any TCC sessions are still running). TCMD is certainly closing, but I don't know what exactly what the installer is doing to shut it (and any TCC tabs) down.
     
  30. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    Try closing the TCMD window yourself while the updater is downloading the new build and see if that makes any difference.
     

Share This Page