Search code examples
node.jsgoogle-cloud-platformsshvirtual-machinegoogle-compute-engine

Does an opened SSH connection to a GCLoud VM prevent it from freezing/crashing?


I have a f1-micro gcloud vm instance running Ubuntu 20.04. It has 0,2 vcpus and 600mb memory.

I write freezing/crashing which stands for just not responding to anything anymore.

From my monitoring i can see that the cpu is at its peak at 40% usage (usually steady under 1%), while the memory is always arround 60% (both stats with my (nodejs) server running).

When i open a ssh connection to my instance and run my (nodejs) server in background everything works fine as long as i keep the ssh connection alive. As soon as i close the connection it takes a few more minutes until the instance freezes/crashes. Without closing the ssh connection i can keep it running for hours without any problem.

I dont get any crash or freeze information from gcloud itself. The instance has a green checkmark and is kind of still running. I just cant open a new ssh connection and also the only way to do something again with this instance is by restarting it.

I have cloud logging active and there are also no messages in there.

So with this knowledge my question is if gcloud somehow boosts ssh connected vms to keep them alive? Cause i dont know what else could cause this behaviour.

My (nodejs) server uses arround 120mb, another service uses 80mb and the gcp monitoring agent uses 30mb. The linux free command on the instance shows memory available between 60mb and 100mb.


Solution

  • Since there were no answers that explained the strange behaviour i encountered. I also haven't figured it out but at least my servers wont crash/freeze anymore.

    I somehow fixxed it by running my node.js application in an actual background job using forever instead of running it like node main.js &.