Website title

Computing: The Details
Lex's blog of curious computer-related shenanigans.

Blog post

He built a robot with three hands

Published: 2026-03-18

He built tables,
he built cabinets,
he built chairs.
He even built rocking horses for children to enjoy.

He built out of wood,
he built things that were good,
he'd build things all day if he could.

He was asked to make this,
he was asked to make that,
he was asked to make more and more.
He would use his hammer, his chisel, a big pot of glue, and also his trusty saw.

He was one of the best,
he was known for his craft.
He could be trusted to build you a seaworthy raft.

He made great things, that many people wanted,
he couldn't keep up with demands.
He one day decided, this should be automated,
so he built a robot with three hands.

He often wished he had a third hand,
he'd use it very often if he did.
His logic was sound, or so he thought,
his robot's arms were more dexterous than his.

The robot made cuts,
the robot sanded edges,
the robot glued boards together.
The robot did what it was told,
the robot could do whatever.

He still finished each object with care and attention,
he had a reputation to uphold.
He said "only a fool would trust this machine",
he said "nobody would be so bold".

The robot left splinters,
the robot left subtle gaps.
The robot made toys from low-quality scraps.

The robot was large, and wasteful, and loud.
The robot worked fast and made sawdust clouds.
The robot once drew blood from its master,
he regretted making the chisel move faster.

He said it was an accident, a one-off event.
He added some controls so it couldn't happen again.

He got an order from a customer he'd seen before,
he needed to deliver two rocking horses to their door.
He knew them well, the couple that lives on the corner,
he was to make the toys for their twin daughters.

He was feeling unwell in a typical way,
he'd caught the flu, so was resting in bed.
He had a deadline, the twin's birthday.
He let the robot build the horses instead.

The robot built tables,
the robot built cabinets,
the robot built chairs.
The robot even built rocking horses for children to enjoy.

He recovered in time to deliver the toys,
he loved days like today, they were full of joys.
He took the horses and put them in the right places,
he saw the excitement on the young girls' faces.

He returned to his workshop, his face was gleaming.
He noticed that the shop needed some cleaning.
The robot was messy, but never did the sweeping.

He cleaned up the dust, and disposed of the scraps,
he looked at his tools as he put them all back.
His chisel was blunt, and his saw was bent,
his pot of glue empty, completely spent.

The robot didn't care, it had a job to do.
The robot doesn't know when it has run out of glue.
The robot had never seen a sharpening stone.
The robot is just a machine, it couldn't have known.

The robot did everything the same every time,
the robot only knew one cabinet design.
The robot lacked character, experience, and care,
the robot just kept making the same old chair.

He got a phone call later that day,
he couldn't believe what the caller had to say.
His horses had hurt those two girls today,
he felt sick again, but in a different way.

One horse collapsed, the seat broke in two,
perhaps that joint really needed more glue.
The other had splinters that pierced through skin,
there was blood on the horse, and an upset twin.

He had a reputation for quality and detail.
He didn't want to show his face after such a big fail.
He refunded the parents with cash in the mail.
In the past, he had a reputation for quality and detail.

Blog post

Giant LED Rubik's Cube V2: Part 1, planning and software stuff

Published: 2026-03-09

This blog post is also available in video form! Watch it on YouTube

I built a Giant Playable LED Rubik's Cube, and I took it to EMF Camp in 2022.

That cube had a single LED per facelet, for a total of 45 LEDs across the cube (because the bottom face is not there, and 5 times 9 is 45). They were powerful LEDs, each one was 3W. That's big for one LED, but not that big for the amount of area covered.

Cube V1 was not playable during daylight hours. It was just a white box. It was only playable after the sun had gone, and the lights were visible. I want to fix that.

EMF 2026 is soon! Perhaps before then I can get enough LED matrix panels to make cube V2 with about 100,000 LEDs this time, rather than just 45. That might actually be capable of combating the sun if I do!

A Giant Rubik's Cube in my living room

The Plan

I have all the old parts from the version 1 cube. Some of them broke in 2022, some of them have deteriorated in the weather as they were stored outside. Some of them are still in good condition.

One of the paddles from the original cube. Warped, rusty, and covered in diry and cobwebs

For the structure of the cube: my plan is to build a new frame for the cube, but to reuse the edge sections. I will need to replace the switch mechanisms on all of the edges, since those were just bare plywood and they all swelled up and seized in the rain in the field in 2022.

By the way, these are very expensive, so if you want to help out then please send me some money on Patreon or YouTube (links in the sidebar). Or, even better, if you know someone who has lots of these panels spare then please tell them I want them!

For the software: most of the software will still work for the new cube, I just need to add in something to generate the video signal for the LED panels.

For the hardware: again, some parts are reusable, but I need some additional hardware for driving the LED panels.

The Panels

There's lots of generic LED panels available, mostly from manufacturers in China, which are all fairly similar in their operation and construction. They tend to be mounted in chassis that lock together in a grid, and have sockets to daisy-chain power and data between the panels. Power is normally from a Neutrik Powercon connector, and data via a thing that is essentially ethernet, and also uses RJ45 connectors.

The LED panels I'm planning to use are square, 0.5m on an edge, and need to be rated for outdoor use.

I currently have one panel. I need 45.

The front of a 48x48 LED panel. The back of an LED panel, showing the connectors. From left to right: Power in, data in, power out, data out.

Phase 1: Software fixes

The first thing I'm doing towards making this new cube exist is to make the software output the right thing.

I can put whatever image I like on each face of this cube, so I'm planning to have a small Linux computer with a modest graphics card to generate the graphics for the cube. I have experience with OpenGL shader programming, so I'm going to have some fancy shaders on the cube hopefully.

The software is currently in 3 parts:

  1. Device: the software running on the Raspberry Pi Pico to read the input switches and (in V1) output data to the WS2811 LED string.
  2. Service: basic game logic. Also handles sound output. Runs on a Linux computer. This part connects to the Device layer via serial-over-USB.
  3. Controller: the GUI that is shown on a small PC monitor near the installation, shows the timer, and the button for starting a new solve. It talks to the Service layer over TCP.

Each layer has a copy of the state of the cube. In the case of the Controller, it displays the current cube state on the screen. In the case of the Service program, it only really needs it for if the Controller connects mid-game and requests to know the current state. For the Device layer, it needs to drive the LEDs, so it needs to know the state to be able to do that.

Because each layer maintains this state, they need to stay in sync. The Device and Service almost never get out of sync, since the USB serial connection is fairly reliable. The Controller can get out of sync if it is connecting over unreliable WiFi, for example.

Regardless of how well these all stay in sync, it's best to make sure that whatever the player sees is considered the canonically correct state. That's why the Device layer is what decides when the user has solved the cube. Even in the worst possible desync state, the game still works correctly.

In version 2 of the cube, it will no longer be the Device code that creates the visual output. I'll be adding in the graphics generation feature to the Service layer, since that's running on a Linux PC with a graphics card, it has the processing power for the task, while the Pico does not. Since it is now what's generating the output, it will also need to become the canonically true model of the game state.

The hardware for the LED panels takes input from DVI or HDMI just like any other display, but comes with configuration software that allows you to specify where each panel is within the resulting frame buffer. I will have a fullscreen OpenGL window displaying on the output, and render the 45 tiles in a grid somewhere on that framebuffer, and then configure the drivers to extract each one to a tile.

Since it's easy enough to do, I will likely have my normal calibration workflow include a step that can move the tiles around in the Service program, so I don't have to deal with reconfiguring the LED hardware in the field.

I've got the basics working. Here's an example of what the framebuffer looks like so far, along with a rendering of a frame mapped on to a cube in Blender.

A grid of coloured squares in the top left corner of a large black rectangle. A rendering of a shuffled Rubik's cube.

What's next

I still need to add animations, and make it look prettier. Then I need to build a case to hold the computer, and build a new frame for the LED panels, since the old frame is too flimsy.

oh, and also obtain a whole lot of LED panels.

Blog post

My Postcode Lookup Library now Supports Partial Postcodes

Published: 2026-01-13

This blog post is also available as a video series! Watch it on YouTube: Part 1 | Part 2 | Part 3

Part of a series of posts: < Previous in series

New feature time!

In the previous blog post in this saga, I introduced my privacy-preserving postcode lookup library that you can use on your website.

Want to use it on your website for a find-my-nearest type feature? find it on Codeberg

Anyway, it now also knows how to find a location from just an outward code!

Quick recap: What's a postcode

A postcode is two parts. Some examples:

Postcode:     | SW1A2AA | B1␣␣1RS |
Outward code: | SW1A    | B1␣␣    |
Inward code:  |     2AA |     1RS |

"␣" = space character

One outward code contains many inward codes in a single geographical area.

Knowing the outward half of a postcode is normally enough to locate a rough area of a city. The Westminster postcode SW1A, for example, contains 143 inward codes at the time of writing.

Postcodes can always be rewritten in what I call the "canonical" format, which is always exactly 7 characters long. Shorter postcodes get padded with spaces between the outward and inward codes, so that they are always 7 characters.

Why use only outward codes?

Sometimes, you don't know an entire postcode for a location you want to search near, but you know some outward codes in the general area. For example, I don't know any specific postcodes in Birmingham, but I do know that B1 is going to be somewhere near the centre of Birmingham. That'd be sufficient to find my nearest store if I'm using a store locator tool on some website while in Birmingham.

It's a good habit to get in to to avoid handing out your full postcode, for privacy reasons. I don't want my lookup tool to break that habit for anyone.

It's a privacy win, and also a usability win!

Okay, so just add them in, why is it that hard?

Aha! With that question, you've activated my trap card!

Strap in!

Okay, so perhaps you're thinking I just need to add an entry for each outward code. It should easily fit in the space for a postcode, since it's smaller than a postcode. Right?

Wrong! The way that I encode a postcode in the file is very particular to the way that it is formatted. The first two characters of the postcode are used to determine which section of the file to search. This is done in the lookup table at the start of the file. This is fine, all outward codes have at least two characters.

Once the software knows the section of the file to search, it starts reading postcodes one by one, checking to see if any one matches the given code. The way it does this is not obvious.

Postcodes processed by this software until now have always been exactly 7 characters long. The last 5 characters of each one is converted in to a number in a mixed-radix.

Here's an example:

S W 1 A  2 A A
| | | |  | | 1  ×           1 =       1
| | | |  | 1    ×          26 =      26
| | | |  2      ×       26×26 =    1352
| | | 0         ×    10×26×26 =       0
| | 27          × 37×10×26×26 = 6753240
| x
x

6753240 + 0 + 1352 + 26 + 1 = 6754619

"??W1A2AA" = 6754619

Eeach column has a set of possible characters that it can contain, and the size of that set determines the multiplier for that column.

So, the postcode SW1A2AA is the postcode with value 6754619 ("W1A2AA"), in the section of the file for the "SW" prefix.

Suppose now I was to encode just the outward code. What does that even mean? I can't just fill in zeros where the missing characters are, since that would accidentally encode a different suffix. For example, I could encode the four character outward code like so:

S W 1 A
| | | 0         ×  1 = 0
| | 27          × 37 = 999
| x
x

0 + 999 = 999

"??1A" = 999

But then how would I tell it apart from this full postcode?:

S W A A  1 M L
| | | |  | | 11 ×           1 =  11
| | | |  | 12   ×          26 = 312
| | | |  1      ×       26×26 = 676
| | | 0         ×    10×26×26 =   0
| | 0           × 37×10×26×26 =   0
| x
x

11 + 312 + 676 = 999

"??AA1ML" = 999

(Note that SWAA1ML is not actually a real postcode. It doesn't exist. However, the format is correct according to the constraints of this encoding, so it is still valid.)

This shows that I can't just put these values in the file without the risk that an old version of the software reads a new file and returns the coordinates for "SW1A" when you search for the non-existent postcode "SWAA1ML". The software needs to behave correctly for postcodes that don't exist, and the old version of the software should not try to read files that include outward-only entries.

Planning for backwards compatibility

When I first defined this file format, I knew I might want to expand on it later. That's why I added a file format version ID in the header. The header looks like this:

UKPPvvvvtttttttt
\__/\__/\______/
  |   |       |
  |   |       \--> Last modified:  64 bits unsigned unix time (8 bytes)
  |   \----------> Version number: 32 bits unsigned           (4 bytes)
  \--------------> Magic string:   Constant: "UKPP"           (4 bytes)

The software checks the magic string and the version field when it first reads the file. If the magic string is not "UKPP", or the version is greater than the maximum supported version by the software, then it refuses to read the file. This is to prevent it reading some incompatible data as if it was a valid postcode pack file.

So, if I generate a new file with the version set to 2, then I don't need to worry about old versions of the software accidentally making up postcodes that don't exist. The other thing I want to do is to enable the new software to read both the old and new file types without having to duplicate too much logic, or write a whole new decoder. That part required a bit more thought.

In file version 1, there's four ways to encode a postcode entry. Each entry indicates which type it is in the first two bits of the entry.

The first byte looks like this:

[ PD | CD | extra ]
   |    |      \----> Meaning depends on PD and CD  (6 bits)
   |    \-----------> Coordinates are delta encoded (1 bit)
   \----------------> Postcode is delta encoded     (1 bit)

That "extra" field is where the postcode delta value is stored if the postcodes is delta encoded. You can tell when that's the case, because PD is set to 1.

So there's already two ways to encode a postcode: as the fully encoded number for the last 5 characters, or as a value to add to the previous one to get to this one.

This means there's a bunch of spare space in the cases where the postcode is not delta encoded, since those extra bits are not used.

First byte   | PD | CD | spare bits
-------------|----|----|------------
0x00         |  0 |  0 | 6
0x40         |  0 |  1 | 6
0x80 to 0xBF |  1 |  0 | 0
0xC0 to 0xFF |  1 |  1 | 0

Available space:
0x01 to 0x3F
0x41 to 0x7F

So if I don't mind being unable to delta encode the outward-only postcodes, then I can add a new encoding for them that uses this spare space.

There's not very many outward codes, so it doesn't bloat the file too much to add them in without delta-encoding them. So that's what I did. I now use the third bit sometimes:

First byte   | PD | CD | entry type   | spare bits
-------------|----|----|--------------|------------
0x00         |  0 |  0 | full         | 5
0x20         |  0 |  1 | outward-only | 5
0x40         |  0 |  0 | full         | 5
0x60         |  0 |  1 | outward-only | 5
0x80 to 0xBF |  1 |  0 | full         | 0
0xC0 to 0xFF |  1 |  1 | full         | 0

Available space:
0x01 to 0x1F
0x21 to 0x3F
0x41 to 0x5F
0x61 to 0x7F

This remains compatible with the version 1 file format. If the new software reads an old file, then it will just look like a version 2 file that happens to contain no outward-only codes. This is because of another thing I did to help backwards compatibility. I made sure that the code that generates these files would always put a 0 in any unused bits in the file. While it doesn't exclude the possibility that someone could craft a malicious file that would give incorrect results, it means that all of the files I generated will work correctly.

(If someone wanted to give you a maliciously broken file, they could already do that anyway, it just wouldn't be as impressive.)

So that's it! Update to the latest version of the library and your website will support outward-only postcode searches.

Part of a series of posts: < Previous in series

Blog post

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:

A digital drawing of Lex's face with a shocked and slightly distressed facial expression. To the right of their face is a few server racks, which are on fire.

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.

A diagram of the architecture of a HPC cluster. There is a network, shown as red lines, which connects many worker nodes, and fewer login nodes. There is also one storage node connected to the network. A remote user terminal connects to a login node (indicated with a large arrow coming in to the cluster from outside). All of the nodes are running the cluster management software.

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.