I nearly crashed a supercomputer that hundreds of other people were using
Published: 2025-12-13
This blog post is also available in video form! Watch it on YouTube
You know that meme where there's a sudden freeze-frame, and then Baba O'Riley by The Who starts playing, and the freeze-frame is of someone in an unfortunate position?
Well, ... that ... and with this still image:

Yep, that's me. You're probably wondering how I got in to this situation.
The Incident
It was a normal morning. I was at my desk, starting to work on a project that I'd recently joined. I was getting fed up of the fact that the build tools for this project didn't work nicely with my shell. I use Fish instead of Bash, and this project had a build system that expected you to be running Bash. There was a sourceme script that was written for Bash, which set up various functions and environment variables to configure the build system.
As one does, when they are fed up of an incompatibility such as this one, they fix it. So I made some configuration changes to my shell to enable me to work on this project conveniently without having to sacrifice use of my favourite interactive shell. I did this by wrapping the Bash sourceme file in a program that would generate a Fish sourceme file from it, which I could then source. Putting those two steps together, I could fully automate loading the build environment.
I was doing this on a High Performance Computing (HPC) cluster, so I was logged in to this machine remotely via ssh. To make the configuration change take effect, I decided to log out and log back in.
When I tried to log in again nothing happened for about a minute or two, and then suddenly I saw a message and the ssh session terminated...
bash: fork: retry: Resource temporarily unavailable
Hmm.
fork is the system call that enables a process to start another process. There's always a limit to how many processes a system can maintain. This is either a de-facto limit determined by the amount of memory available, or it is an explicit limit enforced by the operating system. Seeing an error when trying to fork that tells you the resource is temporarily unavailable means that the system has decided you're not allowed to fork any more, you've hit your limit.
Well, that's funny. I guess I can't ssh in to login4.
(To use the computing cluster you would log in to one of the login nodes login1 to login12)
Someone must be fork bombing login4. That's kinda embarrasing, wouldn't want to be whoever's doing that.
(A fork bomb is program that repeatedly forks and restarts itself to waste system resources, usually as a prank or denial of service (DoS) attack)
Let's try login5.
bash: fork: retry: Resource temporarily unavailable
They're fork bombing this node too!? Wow I bet someone's having a bad day today.
...
...
OH NO! IT'S ME! I'M THE ONE HAVING THE BAD DAY!
The Immediate Aftermath
So, I realised that it was me. I was the problem. I ran over to ask a colleague to try logging in to the nodes that I had tried. Strangely enough he was able to log in to login4 without any issue. I was releived, I hadn't broken it for everyone, only for me.
I asked him to show me the process tree for that node, so he ran ps -faux or something similar, and I saw something like this:
...
lex 1656 ... \_ /usr/bin/fish
lex 1657 ... | \_ /bin/bash
lex 1658 ... | | \_ /usr/bin/fish
lex 1659 ... | | | \_ /bin/bash
lex 1660 ... | | | | \_ /usr/bin/fish
lex 1661 ... | | | | | \_ /bin/bash
...
So ,clearly there was something bad going on. I had to get it stopped, but I had no way to log in to stop it, and my colleague wasn't able to stop it for me because he didn't have permission to terminate my processes. So I had to email the IT support address and ask them to resolve it for me. I asked them to terminate all processes that belonged to me on all login nodes, and also asked them to rename my Fish config file, so that my botched configuration was no longer loaded when I logged in.
There was nothing more I could do at that point, so I went for lunch, and by the time I came back I had en email reply from IT saying the had resolved everything.
I was able to log in, and fix my mistakes.
Cluster Computing
Before I can explain what went wrong, I need to start with a little explanation about how a High Performance Computing Cluster works.
The kind of machine I was using is not simply “a really big computer”. As nice as it would be to have a device that can just run the same programs as your desktop PC, but thousands of times faster, that’s not something that’s practical to build.
This machine, like most other high performance computers, is actually just lots of small computers all working together. As such, if you just run a normal program on it, then it won’t go any faster. If you want to actually make use of the resources available, then you need to write a program that is specifically designed for cluster computing.
There’s more to it than just a big pile of small computers. There’s a high speed network joining all the nodes together, and joining them to shared storage systems. There’s also a software layer on top of all of this to make it easy to deploy your program across the network, keep nodes in sync, and return the results to you after a run has completed. This software layer also tries to make sure everyone that uses the cluster has fair access to it. Anyone can add a job to the queue, and then the software decides when to deploy jobs from the queue to available nodes. Some jobs require lots of nodes, others that don’t make such good use of the cluster will only use one or two nodes.

Although it was technically possible to bypass this software layer, and log in to any node you wanted to, this is not how you were supposed to use the computing cluster. The cluster I had access to had hundreds of nodes, but 12 of them were special. These 12 nodes were known as Login Nodes.
The normal workflow is to log in to a login node, queue jobs from that node, and wait for results. Your job will run on the worker nodes once it has been through the queue. It doesn’t run on the login node.
If you accidentally forgot to use the job submission command to queue your job, and just ran it directly on the login node, then you’d probably be using a lot of resources on the login node, and thus slowing it down so much that it’s hard for other people to use it. This is bad cluster user etiquette.
This architecture means that lots of people are all queueing jobs from the same 12 machines. I wrote a little script that would log in to each one in turn and tell me how many users were on each one, so that I could choose to log in to whichever one had the fewest users. It was quite handy.
If something was soaking up all of the resources on all the login nodes, someone would notice very quickly, and anyone else in the company using the cluster would be prevented from getting work done. We had 12 login nodes. If I remember correctly they averaged about 50 active user sessions each at any given time. Some of these will be the same user holding multiple sessions open, but this should give you an idea of the number of people you’d disrupt if you took these machines down.
What Actually Happened
To recap the scenario: I was working on a large project with a very complicated build system that had a lot of different options that were controlled mostly by environment variables. Part of the source code for this project was a “sourceme” file that set up these variables according to some configuration files, and also defined some functions that could manipulate the variables for choosing different build options.
This “sourceme” was designed to work with Bash. Bash is the default user shell for most of the popular Linux distributions. However, I prefer to use Fish shell. Unfortunately, nobody else had provided a Fish version of the “sourceme” file, so I had to make my own.
The first option for doing this would be to make a copy of the Bash version, and then manually translate all of the Bash syntax in to Fish syntax. Unfortunately, the file was incredibly large, and I didn’t want to port all of it manually. Instead, I chose to write a small wrapper around the Bash version, that would start Bash, take a snapshot of the environment, source the sourceme file, and then take another snapshot. It would then compare these snapshots to find out what the sourceme file had actually changed, and then generate Fish code that makes the same changes. This means I don’t have to worry about all of the complexity of the Bash version, nor do I need to duplicate all of the code and maintain it separately.
An important part of the code generation step was to make sure that the contents of the variables was suitably escaped. Imagine I had a variable with the following value, and wanted to generate Fish code to set it:
(exit '1') # "Failure" condition
I can’t just put that string directly in the code, because it creates valid code that runs some other program. That’s no good, that’s a security risk!
There's a Fish builtin command for this
string escape "some string here"
# or
some_command | string escape
So obviously I'm going to use that to escape the strings from my Bash script wrapper
My Bash code would run Fish with the -c option, which means “instead of being an interactive shell, just run this one command and then exit”.
printf '%s' "$VALUE" | fish -c 'string escape </dev/stdin'
(Warning, the above code is subtly wrong, explanation later...)
Hooray! I can work on this project from Fish! I no longer have to suffer with Bash!
This really did work perfectly fine, at first. I knew that I was going to be working on this project almost every day for a little while, so I decided it would be useful if this sourceme file would be sourced automatically every time I logged in. So I added it to my Fish config file, which Fish executes on startup.
This is where I made the first mistake!
After changing your shell config, it’s normally a good idea to manually start your shell from inside your current session to test that the change is good. If your shell won’t start, because of a catastrophic error in your config file, then you won’t be able to log in and start a new session because your shell program starting and ending is what determines when your session starts and ends. If your shell won’t run, you can’t log in with ssh. So the best practice is to try running it in your current session, and then fix any issues before you log out.
I didn’t do this. I thought I had already done enough testing. I decided to immediately log out and log in again to restart my session and get the new config.
I was not able to log in again.
The first clue as to what went wrong was in the error message. When I tried to log in, some program in the chain of programs that handle my ssh session had tried to use the “fork” system call, but was unable to because Linux had decided that there was not enough resources left to complete the fork. This could happen because the system had run out of memory, or because a fork limit was reached. It could be my own personal fork limit, or a global fork limit.
The second mistake that I made was assuming that I was not responsible for the system reaching a resource limit. I had assumed that someone else had accidentally run a fork bomb on the login machine.
Aside: What's a fork bomb?
What’s a fork bomb? Well, it’s a program that repeatedly forks in to two copies of itself. This create an exponentially growing number of processes. After just ten iterations of this, you’ve got over a thousand copies of the program. After another ten, you’ve got more than a million. Long before you get to this stage, you’ll start to see that your system is running much slower, as the Linux scheduler needs to spend more time keeping track of all of the processes that are running.
Eventually the process descriptor table becomes full, so forks start to fail, and some copies of the program will terminate without forking. As they do, this frees up space in the process descriptor table, and so some others that haven’t forked yet can now fork successfully again. You now have a system that is fully saturated with processes. Most of them are just wasting your CPU time by creating copies of themselves, so the programs you really care about don’t get as much CPU time as you’d like.
Stopping a fork bomb requires terminating all of the instances of the fork bomb simultaneously. If even one instance remains, and it hasn’t forked yet, then it is enough to restart the entire attack.
But I didn't write a fork bomb, right?
I thought I had encountered the effects of someone else’s accidental fork bomb. For this reason, I decided to try logging in to a different login node.
Once this node also presented the same error, I started to reconsider my initial conclusion.
I almost ran the script that I had, that would log in to each login node in sequence and tell me the number of active sessions on each one. This would have resulted in my accidental fork bomb running on every one of the login machines. I remember starting to type the command and thinking “but if it is me that’s the problem, this could take down all of the login nodes”.
I paused for a moment, and carefully pressed backspace to erase the command I was about to run.
My fear that I was the problem was confirmed when a colleague of mine was able to log in without any issues to the same nodes that I was trying to log in to, and could see the trail of destruction I had left in my wake.
I was the problem. I had indeed accidentally written a fork bomb that would automatically run when I tried to log in, and would prevent me from successfully logging in.
I had to email IT support to ask them to fix it.
The reason why it happened was quite simple. Fish will read and execute its config file before running a command provided to it in the -c option. So if you have something in your Fish config that runs a Fish command with fish -c, well, now whenever fish starts, it’s going to start fish, and wait for it to finish before it continues. The problem is, that new instance of fish will do the same thing.
By adding the sourceme file to the Fish config, I had changed the behaviour of the sourceme file. It was now a fork bomb. Well, technically not really, it doesn’t expand exponentially, like a traditional fork bomb does. It is only linear. But it’s still a huge problem.
The reason I was not expecting this is because I assumed that the -c option in Fish would behave like the -c option in Bash. Bash will skip loading user config files when -c is provided. To make Fish skip config files, you need to additionally provide the -N option.
The thing that stopped this being a catastrophe for any machine that I logged in to, and the thing that allowed my colleague to log in while my session was floundering, was the per-user fork limit.
Fortunately, the IT department had configured the login nodes to be fairly restrictive with per-user fork limits. They could handle one user hitting their limit and still provide a good service to the other users. This meant that the incident had a big impact on me, but almost no impact on anyone else.
It’s also possible that this was not actually forward thinking, and was a reaction to a previous incident, or maybe the OS they use has a sensible set of defaults. I think it was RedHat Enterprise Linux, but I can’t remember now.
Anyway, that’s my confession about the biggest mistake I ever made with access to a high performance computing cluster. I don’t work at that job any more, but not because of this incident. I continued to work there for a while, then moved on to something else.