A duplicate instance of my app is running an older version of my code

PROBLEM:
An older version of my code is still running on the glitch servers in combination with the newer version.
I’ve had this happen to me before and after a while this resolved itself.
But now that it happened again, I’m looking for a more durable solution.

DIAGNOSTICS:
I noticed this because I saw that my slack-bot was double responding to commands (one with “old” answers).
I am not running this bot locally nor am I running this bot anywhere else.
I checked the terminal to see if 2 processes were running at the same time (using ps -aux) and found only 1 instance.
I tried unboosting my app so that the duplicate instance would stop running, but that did not help.

WORKAROUNDS:
I currently disabled my newer version of the code.

  • suboptimal: I’m now not able to run the newest version.

I baked in a versioning mechanism, so if in the future this ever happens again, I would be able to disable the old version trough the means of a bot command.

  • better: I’ll be able to disable the old version and run the newest version, but still an old “disabled” version would be running somewhere on the glitch servers.

SOLUTION?
I suspect that Glitch is running 2 different virtual machines each running 1 instance of a different version of my code.
If this is indeed the case, what remedy exists for this problem?

Hi @heartkore :slight_smile: Great question including all the things we need to know - not something we get a lot around here :joy: Could you ask support@glitch.com the same and see if they can look at where you code is being ran?

2 Likes

ps -A, look for processes with node and use kill {number} to kill them. Obviously some of them are for glitch internally so some you might fail to kill.
Tip: ps -A | grep node shortcut for finding node processes

Or see if those files are hidden with ls -a :wink:

Hi javaarchive, thank you for your response.
However, I have checked to see if there was a duplicate process using ps -aux.
This gave me the entire and detailed list of running processes.

And as you can see, there’s only one instance of “server.js” running here:

$ ps -aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 19716 2896 ? Ss Jul05 0:00 bash /usr/bin/start-container
root 6 0.0 0.0 4236 552 ? S Jul05 0:00 runsv /etc/service/watcher
root 7 0.0 0.0 208 4 ? S Jul05 0:00 /usr/bin/dumb-init /bin/bash ./run
root 8 0.0 0.0 19700 2900 ? Ss Jul05 0:00 /bin/bash ./run
root 9 0.0 1.3 1006604 84068 ? Rl Jul05 1:18 node build/source/index.js
root 94 0.0 0.0 4500 620 ? S Jul05 0:00 /bin/sh /opt/nvm/versions/node/v10/bin/wetty --port 1084 --command /opt/wetty/wetty-command.sh --base /
root 103 0.0 0.7 862912 50272 ? Rl Jul05 0:02 /opt/nvm/versions/node/v10/bin/node /opt/nvm/versions/node/v10/bin/…/pnpm-global/1/node_modules/wetty.js/index.js --port 1084 --command /opt/w
root 123 0.0 0.6 871396 38184 ? Sl Jul05 0:22 /opt/nvm/versions/node/v10.15.3/bin/node /opt/watcher/build/source/ot-storage.js /app
app 448 0.0 0.0 19784 3152 ? SNs Jul05 0:00 bash /opt/watcher/app-types/node/start.sh
app 460 0.0 0.0 19784 1804 ? SN Jul05 0:00 bash /opt/watcher/app-types/node/start.sh
app 461 0.0 0.5 900788 32348 ? SNl Jul05 0:00 node --icu-data-dir=node_modules/full-icu server.js
root 503 0.0 0.0 19712 3128 pts/0 Ss 00:06 0:00 /bin/bash /opt/wetty/wetty-command.sh
root 508 0.0 0.0 51000 2848 pts/0 S 00:06 0:00 su --preserve-environment --login app
app 509 0.0 0.0 19964 3388 pts/0 S+ 00:06 0:00 -su
root 519 0.0 0.0 19712 3092 pts/1 Ss 00:06 0:00 /bin/bash /opt/wetty/wetty-command.sh
root 524 0.0 0.0 51000 2860 pts/1 S 00:06 0:00 su --preserve-environment --login app
app 525 0.0 0.0 19968 3600 pts/1 S 00:06 0:00 -su
app 830 0.0 0.0 36084 3064 pts/1 R+ 06:12 0:00 ps -aux

Try renaming your package.json so it turns into a directory listing and then renaming it back

Changed this to #glitch-help

If glitch is running a new and and old version of my code on 2 seperate node instances on 2 different VM’s how will renaming the package.json in the newer version of the code help? This will kill the newer instance and try to re-install all node packages, not affecting the old running instance (which I actually want to stop) at all.

@RiversideRocks @javaarchive @EddiesTech @khalby786 thank you all for taking interest in helping me with this matter.

A few hours ago the duplicate instance of my project (running the old code) got killed without any intervention. So just like last time I had no control over the situation and I just had to wait for this to eventually happen.

With the old version gone, I improved the resilience of my project because I’m able to host the most recent version of my code where I implemented a killswitch to kill old ghost instances in the event that another ghost instance of my project ever pop’s up again.

So while I made it workable on my end (killswitch for old ghost instances), I still believe the Glitch infrastructure might be experiencing some kind of bug which causes duplicate instances to be hosted.

3 Likes