Skip to content

Add a hard limit on field list size #5843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rdettai
Copy link
Collaborator

@rdettai rdettai commented Jul 15, 2025

Description

Searchers sometime OOM when returning too many fields (~millions). This PR adds a hard limit on the number of fields that can be returned.

  • configured through an env variable QW_FIELD_LIST_SIZE_LIMIT
  • if there are more fields than the limit, a 500 error is returned

How was this PR tested?

Describe how you tested this PR.

@@ -184,6 +198,12 @@ fn merge_leaf_list_fields(
flush_group(&mut responses, &mut current_group);
}
}
if responses.len() >= get_field_list_size_limit() {
return Err(SearchError::Internal(format!(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could return a truncated list instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern with a truncated list is that it doesn't clearly indicate that something went wrong and that results are not deterministic. This is really a short term patch to prevent excessive memory usage, but I think we should work on a proper solution that correctly prunes the long tail of "rare" fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants