Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Version 17 Installer Leaves Multiple Copies of ShrAlias

Jun
538
3
I have found that after installing updates there are multiple copies of ShrAlias running (I have seen as many as three).

-- Jay
 
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
 
If the installer couldn't stop it, it couldn't install a new file. I suspect that would generate an error message.
 
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.
 
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
 
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.
 
Here is the screen that is shown. It claims to be the "Advanced Installer".

-- Jay

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

Attachments

  • upload_2014-11-10_17-2-14.png
    upload_2014-11-10_17-2-14.png
    72.5 KB · Views: 280
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)?
 
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.
 
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.
 
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.
Q: Were any there after the install but before you launched anything?
 
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.
 
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.
 
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
 
And I suppose that could also happen with only one TCC if TCSTART.BTM caused a transient/pipe instance of TCC to be started.
 
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.
 
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.

Hmmm.... Perhaps Take Command should have an option to automatically start SHRALIAS before any tab windows?
 
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.
 
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

...
...
 
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.
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
 
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.
 
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
 
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
 

Attachments

  • upload_2014-11-13_6-24-1.png
    upload_2014-11-13_6-24-1.png
    25.5 KB · Views: 255
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)?
 
Curious ... did you notice if TWO TCCs were started (to handle the registration dialog, before TCMD)?

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).
 
TCC is not used at all during installation. (Nor is TCMD, IDE, or SHRALIAS.)

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.
 

Similar threads

Back
Top