Terminal not working, resource unavailable I had a terminal session open and after I woke my laptop up I cannot use the terminal nor create new sessions.

The error I get on the opened session is:

-bash: fork: Resource temporary unavailable


The error when trying to open new terminal:

[forkpty: Resource temporary unavailable]
[Could not create a new process and open a pseudo-tty.]


Looking deeper, I was able to open the Activity Monitor and I found that there was a very large number (thousands) of processes linked to the same application, VShildScanner. From here, I wasn't able to kill those processes.  

I tried to restart or shutdown the system, since I wasn't able to do anything else, but those also failed. I was only able to power cycle.

My thought was to run a killall from the terminal but I can not get a functioning shell / terminal window once the system is blocked. 

Are there better ways to handle such a situation when processes grow out of proportions?
Your machine definately has too many processes running which is the typical reason for that error message and aligns with Activity monitor. Since you can't restart or shut down, I would have only the following:


quit any / all apps you can and very quickly get a new terminal / shell running. There's small chance you will get a process before the runaway one uses up any freed resources, but you might get lucky: you only need one fork/exec/thread to get a shell. 


If not, you will likely need to try escalating steps like log out of the user session and then back in. (or restart or shut down or pulling the power or holding the power button to disrupt all power and hard halt the machine.)

Maybe sshd is running and you could attempt that or Remote Desktop to connect as a second user if you have both screen sharing and another account set up. Again, it's not likely the system stat will allow new processes, but it's worth trying.

Sorry the  VShildScanner process is misbehaving. This is a case where the "virus software" is worse than the protection it offers. 


https://community.mcafee.com/t5/Mac-and-Linux-Products/Multiple-VShieldScanner-processes/td-p/508106