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
Unknown Object (File)
May 28 2025, 1:20 PM
Unknown Object (File)
May 7 2025, 7:42 AM
Unknown Object (File)
May 3 2025, 10:08 AM
Unknown Object (File)
Apr 29 2025, 4:49 PM
Unknown Object (File)
Apr 28 2025, 12:35 PM
Unknown Object (File)
Apr 17 2025, 4:50 PM
Unknown Object (File)
Apr 10 2025, 11:47 PM
Unknown Object (File)
Apr 8 2025, 1:17 AM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable