Optimization · Industrial hardware

Making eight label printers stop locking up

Every warehouse has a printer that people have simply learned to reboot. It's treated as a hardware quirk. It usually isn't.

8 printers under management
~150x logo payload reduction
3 send attempts per job
Confidential client & operation

Built for a contract-logistics site running eight networked industrial label printers.

Label printing: the logo stored once per printer, recalled by a 24-byte instructionBefore, every label carried the company logo inline: 3.5 KB of compressed bitmap describing a 17 KB image, sent again in full on every print. After, the label carries a 24-byte instruction that recalls the logo from the printer's onboard flash, where it is stored once per printer under a name derived from its content hash. The label as sent is four lines of ZPL. Below that, the transport layer: a per-printer lock whose acquisition times out, the send with up to 3 attempts, a half-close in the write direction so the printer frees its one connection slot at once, and a cooldown between jobs. At the bottom, the three-valued check made before a label is rewritten: yes recalls by name, no uploads and verifies first, and no reply sends the full image inline exactly as before. A status board polls all 8 printers in parallel for paper out, head open, ribbon out, paused and offline.BEFORE · EVERY LABELlogo bitmap, inline3.5 KB of compressed bitmapdescribing a 17 KB image, sentagain in full on every printAFTER24-byte recall instructionin place of 3.5 KB of bitmap~150xlogo payloadreductionOnboard flash, per printerE:A7F3E9C1.GRFnamed by content hash, so the samename on every printer and acrossrestartsuploaded once, then verifiedTHE LABEL AS SENT · ZPL II^XA^XGE:A7F3E9C1.GRF,1,1^FS^FO50,50^A0N,30,30^FDRECEIVING^FS^XZline 2 recalls the stored logo by name: 24 byteswhere 3.5 KB of inline bitmap used to sit onevery labelTRANSPORT LAYER · WHAT WE BUILT · ONE JOB AT A TIME PER PRINTERPer-printer lockjobs to one device run in series;acquiring the lock times out, so awedged printer fails fastSend the jobraw TCP to the printer's port, upto 3 attempts per jobHalf-close, write sidethe printer sees a cleanend-of-stream and frees its oneconnection slot at onceCooldowna short pause before the next jobto the same deviceBEFORE A LABEL IS REWRITTEN · THREE ANSWERS, NOT TWOPrinter holds this graphic?asked by name, on every labelRecall by namethe 24-byte instruction does the restUpload, verify, then recallrewritten once the upload is verifiedSend the full image inlineas before: the logo is never missingYESNONO REPLYStatus board8 printers polled in parallelpaper outhead openribbon outpausedofflinestatus replies are read before the half-closeNo reply is never read as yes. Any partial failure returns the original label untouched rather than a half-converted one: the optimization is allowed to notapply, and never allowed to produce a wrong label.
Every label used to carry the logo bitmap in full; now a 24-byte instruction recalls it from the printer's own flash. The question "does the printer hold this graphic" has three answers, and no reply means the full image goes inline, exactly as before.

Why did eight label printers keep locking up?

The eight label printers locked up because their print servers take one connection at a time on the raw port, and every label resent the logo bitmap in full. We serialized jobs behind a per-printer lock, closed each connection cleanly and stored the logo in printer flash, recalled by a 24-byte instruction. The lock-ups stopped.

Printers wedged during bursts and stayed wedged until someone power-cycled them. On a receiving dock, that stops work.

There were two real causes and neither was hardware failure. These print servers accept one connection at a time on their raw port, and concurrent or half-closed connections leave them stuck. And every label carried the company logo inline — three and a half kilobytes of compressed bitmap describing a seventeen-kilobyte image — sent again, in full, on every single print. Both causes sit in the traffic, not the printer, and that is where label printer and print-queue work usually starts.

What we built

A transport layer that respects what the hardware can actually do. Jobs to the same device are serialized behind a per-printer lock. Connections are shut down in write direction before closing, so the printer sees a clean end-of-stream and frees its connection slot immediately rather than waiting out a network timeout. A short cooldown sits between jobs to the same device, and lock acquisition itself times out — a wedged printer fails fast instead of queueing work behind it forever.

Then the payload problem. The printers can store graphics in onboard flash and recall them by name, so the logo only needs to be sent once per device, ever. It is a small change with a large effect wherever ZPL and print-and-apply on the warehouse floor runs labels by the thousand.

  • The logo is fingerprinted by content hash, so the same image gets the same name on every printer and across restarts
  • The printer is asked whether it already holds that graphic, and the upload is verified before the label is rewritten to use it
  • The inline image becomes a short recall instruction — twenty-four bytes in place of three and a half thousand
  • Status queries read the reply before half-closing, because these print servers abandon a pending response the moment they see a close

Logo sent inline or recalled from flash

Per labelLogo sent inlineLogo recalled from printer flash
Bytes for the logoAbout three and a half kilobytes of compressed bitmapA 24-byte recall instruction
How often it is sentOn every single printOnce per printer, verified after upload
Name of the graphicNoneIts content hash, the same on every printer and across restarts
If the printer does not answer the checkNot applicableThe full image goes inline, exactly as before

What happens when the printer doesn't answer?

The interesting decision is what happens when the printer doesn't answer. There are three possible answers to 'do you already have this graphic' — yes, no, and no reply — and treating the third as a 'yes' would produce labels with a silently missing logo.

So the check is explicitly three-valued. No reply means the full image is sent inline, exactly as before. Any partial failure returns the original label untouched rather than a half-converted one. The optimization is allowed to not apply; it is never allowed to produce a wrong label.

A live status board polls every printer in parallel and reports paper out, head open, ribbon out, paused or offline — so the question 'is the printer broken or is it out of labels' has an answer on a screen.

The result

The lock-ups stopped. Print volume that previously wedged the hardware runs through it, and when a printer genuinely does have a problem, the board says which one and what kind.

This is the pattern of most performance work we do: measuring where the time goes before changing anything. Nothing was rewritten and nothing was replaced — the fix came from reading the hardware's documentation carefully enough to find out what it had been trying to tell us. The office version of the same problem has its own guide: why an office network printer keeps going offline.

Questions about this build

How do you stop resending a logo on every ZPL label?

Store it in the printer once and recall it by name. Zebra printers can download a graphic into onboard storage and recall it on each label with ^XG instead of an inline ^GF graphic field. Here the logo is named by its content hash, the printer is asked whether it already holds it, and the upload is verified before labels switch to the 24-byte recall.

Why does a label printer need a lock per printer?

These print servers accept one connection at a time on their raw port, and concurrent or half-closed connections leave them stuck. Serializing jobs behind a per-printer lock, with a short cooldown between jobs and a lock that times out, means a wedged printer fails fast instead of queueing work behind it, and each job gets three send attempts.

Built with

  • Python
  • Raw TCP sockets
  • Zebra ZPL II
  • Per-device connection locking
  • SQL Server

On the details we left out

Client, location, system names and volumes are withheld deliberately. We're happy to go deeper on architecture and approach on a call.

Services this draws on

Workload Optimization

Squeeze more throughput out of the hardware and licenses you already pay for.

See Workload Optimization →

Code Rescue & Support

Inherited an undocumented system nobody dares to touch? We make it safe to change.

See Code Rescue & Support →

Enterprise IT Services

Managed and co-managed IT across Texas with 24/7 support, from a ten-person office up — Active Directory to the printer that keeps dropping offline.

See Enterprise IT Services →

More projects

Hardware bridge · Fleet deployment

Making a badge reader work in a browser that can't see it

Browsers are not allowed to talk to smartcard hardware, and the kiosk desktops were centrally managed. We built a small local service that bridges the reader to the page — then packaged it so it installs, restarts and heals itself across a fleet.

Read the story →
Operations platform · Built for ourselves

One app that runs the whole company, and keeps score

The Do-Engine is the operations app we built to run our own business: a task board, a client book, a document vault, invoicing, a help desk and a mail client in one page, with a single XP ledger scoring everything that gets finished.

Read the story →
Platform · Multi-year build

One application that replaced a decade of spreadsheets

A warehouse ran its floor on shared spreadsheets, emailed reports, and tribal knowledge. We replaced all of it with a single internal platform — and kept it running while people worked.

Read the story →
Get in touch

Is there a printer your floor has learned to reboot?

Send the model and what it does under a burst. Talk to an engineer.

Prefer to talk?

Call 832-598-8234 or email msco@stoneagesoftware.com. Houston, Texas — serving Houston, The Woodlands, Conroe, Sugar Land, Katy, Pearland, and the Greater Houston metro.

What happens next

We read your message, an engineer replies with questions or a straight answer, and if a call would help, we book one. From the first reply on, you're talking to the people who'd do the work.

No obligation — we reply within one business day. This form sends your details to Stone Age Software LLC so we can respond to you. See our privacy policy for how we handle them. This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.