Engineering · Printing

When a picture holds up the docket

We put the venue logo on printed receipts. The code handled every way that can fail — except the one where the server accepts the connection and then says nothing at all, which is not a failure at all.


A receipt looks better with the kitchen's logo on it. Ours fetches that logo when the printer asks for the job, turns it into the dots a thermal head understands, and prints it above the order.

The function that does it carries a promise in its own comment: never throws — a broken logo must not stop a docket. That is the right promise. A receipt printer is not the place to be strict. If the logo is a format we cannot read, or the file has gone, or the address is wrong, the receipt should print with the venue's name in large type and nobody should ever find out there was a picture involved.

We went and ran it, rather than reading it, and every one of those failures does exactly that. A missing file, a wrong format, a dead address, a refusal to decode — all of them come back empty and the docket prints.

The failure that is not a failure

There is one more way a request to another computer can go. It can be accepted and then answered by silence. The connection opens, the far end says nothing, and it keeps saying nothing.

That is not an error. Nothing is thrown, so a catch never sees it. The function simply never finishes. Our own test sat waiting on it until we gave up and killed the test.

Now put that where it actually lives. This runs while the printer is holding the line, after the job has been marked as taken. So a logo address that goes quiet does not produce an ugly receipt. It produces no receipt: the printer waits, gives up, the job is handed back two minutes later, and it waits again. There was no limit on how many times.

What this means if you run a kitchen

If you have ever pointed a system at an image on your own website, you have this shape somewhere. The question to ask a supplier is not "what happens if the image is missing" — everyone handles that. It is "what happens if the server stops answering", which is what a hosting bill lapsing or a DNS change actually looks like from the outside.

Ours now waits three seconds and then prints the plain header. Three seconds because a logo is worth a moment and is not worth a docket. It also refuses a file over two megabytes, because a header on 80mm paper is a few kilobytes and nothing that size is a logo.

Worth saying plainly: no venue on our platform was exposed to this. Every logo we hold is stored in our own object storage, which never makes an outside request at all. It was one pasted web address away from being live, which is exactly why it is worth fixing on a quiet Sunday rather than on a Friday night.


Try it on tonight’s service.

Nothing to install, no card. Not better by the weekend? Close the tab.