Page MenuHomePhabricator

Prevent worker queue leases from exceeding 64 characters

Authored by epriestley on Dec 16 2014, 11:14 PM.
Referenced Files
Unknown Object (File)
Thu, Jun 1, 1:57 AM
Unknown Object (File)
Sun, May 28, 9:31 PM
Unknown Object (File)
Mon, May 22, 9:47 PM
Unknown Object (File)
Apr 15 2023, 10:12 AM
Unknown Object (File)
Apr 8 2023, 5:19 AM
Unknown Object (File)
Apr 8 2023, 4:36 AM
Unknown Object (File)
Apr 7 2023, 3:47 PM
Unknown Object (File)
Apr 6 2023, 5:35 PM



Ref T6742. Root cause of the issue:

  • Daemon was running on a machine with a very long host name, which produced a lease name which was longer than 64 characters.
  • MySQL wasn't set in STRICT_ALL_TABLES.
  • The daemon would UPDATE .. SET leaseOwner = <very long string> to lock a task, and MySQL would silently truncate.
  • The daemon would then try to select the locked task, but fail, because there's no matching lease owner.

To resolve this, use only the first 32 characters of the hostname. See IRC for more discussion.

Test Plan

Will confirm with reporter.

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Prevent worker queue leases from exceeding 64 characters.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
btrahan added inline comments.

should we use PhutilStringTruncator here instead? I am not sure how fancy these characters could end up being.

This revision is now accepted and ready to land.Dec 17 2014, 5:11 PM

I think we're safe assuming hostnames are ASCII, although I'm not 100% sure. I'll swap to StringTruncator just in case. T6768 should eventually provide a cleaner fix for this.

epriestley edited edge metadata.
  • Use PhutilUTF8StringTruncator.
  • Ran phd debug taskmaster with a very short truncation length and got sensible leaseOwner name.
This revision was automatically updated to reflect the committed changes.