Page MenuHomePhabricator

Limit the damage that degenerate project name typeahead queries can cause
ClosedPublic

Authored by epriestley on Aug 30 2017, 6:22 PM.
Tags
None
Referenced Files
F15450925: D18506.id.diff
Fri, Mar 28, 7:06 PM
F15446268: D18506.id.diff
Thu, Mar 27, 6:05 PM
F15445427: D18506.diff
Thu, Mar 27, 1:50 PM
F15437729: D18506.diff
Tue, Mar 25, 9:12 PM
Unknown Object (File)
Feb 17 2025, 1:29 AM
Unknown Object (File)
Jan 29 2025, 11:23 PM
Unknown Object (File)
Jan 27 2025, 3:12 PM
Unknown Object (File)
Jan 24 2025, 6:30 PM
Subscribers
None

Details

Summary

See PHI47. When users copy/paste a wall of text into a project tokenizer, we can end up performing a very large number of JOINs.

These JOINs seem okay locally and on secure, but the install in PHI47 reports hitting issues.

Since these queries are almost certainly illegitimate (I think no one uses 5+ words to find a project), just limit the search to the 5 longest tokens.

Note that typing 6 tokens will still almost always work, since the UI does additional filtering. However, if you have 100+ projects named "a b c d e ..." and search for "a b c d e z", you may not hit it. This is so degenerate that it's hard to imagine any users encountering it.

This is a stopgap fix, I'll file something longer-term as a followup.

Test Plan

Used /typeahead/class/PhabricatorProjectDatasource/ to run queries. Saw the same results with shorter query plans for all reasonable queries.

Diff Detail

Repository
rP Phabricator
Branch
token1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 18225
Build 24512: Run Core Tests
Build 24511: arc lint + arc unit