Skip to content

Conversation

wazir-ahmed
Copy link
Collaborator

  • Add new mysql/pgsql variable processlist_max_query_length.
    • Min: 1K
    • Max: 32M
    • Default: 2M
  • Truncate current query based on the configuration before inserting into stats_*_processlist tables.
  • Refactor/fix code related to other processlist configurations.
    1. session_idle_show_processlist value was not updated in ProxySQL_Admin.variables.
    2. Pass processlist config as an argument to MySQL_Threads_Handler::SQL3_Processlist instead of using thread-local variables.

Copy link

Summary of Changes

Hello @wazir-ahmed, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical stability issue where excessively long queries could lead to SQLITE_TOOBIG errors and crashes when populating processlist tables. The core solution involves introducing a configurable maximum query length for processlist entries and implementing a truncation mechanism. Additionally, the PR refactors how processlist-related configurations are managed, moving them from thread-local storage to a centralized structure within the ProxySQL_Admin and passing them explicitly, which also resolves a bug with session_idle_show_processlist not updating correctly.

Highlights

  • New Configuration Variable: Introduced processlist_max_query_length for both MySQL and PostgreSQL, allowing users to configure the maximum length of queries displayed in the processlist. This variable has a default of 2MB, a minimum of 1KB, and a maximum of 32MB.
  • Query Truncation: Implemented automatic truncation of long queries based on the new processlist_max_query_length setting. This prevents potential SQLITE_TOOBIG errors when storing processlist information, ensuring stability and preventing crashes.
  • Processlist Configuration Refactoring: Centralized processlist-related configuration variables (show_processlist_extended, session_idle_show_processlist, processlist_max_query_length) into a new processlist_config_t struct within ProxySQL_Admin. These settings are now passed as arguments to the SQL3_Processlist functions in MySQL_Threads_Handler and PgSQL_Threads_Handler, removing their previous reliance on thread-local variables and fixing an issue where session_idle_show_processlist was not being updated correctly.
  • Admin Interface Query Display: Modified SHOW PROCESSLIST, SHOW PGSQL PROCESSLIST, and SHOW PGSQL ACTIVITY commands in the admin interface to display the full (potentially truncated) query string, rather than a hardcoded 100-character substring, aligning with the new processlist_max_query_length setting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@wazir-ahmed wazir-ahmed linked an issue Oct 16, 2025 that may be closed by this pull request
8 tasks
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a mechanism to prevent crashes from SQLITE_TOOBIG errors by truncating long queries in the processlist. It adds a new configuration variable, processlist_max_query_length, for both MySQL and PostgreSQL to control the maximum length of queries stored. Additionally, it refactors the processlist configuration handling by grouping related variables into a struct and passing it as an argument, which improves code clarity and maintainability by removing the reliance on thread-local variables. The changes are well-structured and address the core issue effectively. I've added a few suggestions for improving robustness and code style.

@renecannao renecannao added this to the Release 3.0.3 milestone Oct 16, 2025
- Add new mysql/pgsql variable `processlist_max_query_length`.
    - Min: 1K
    - Max: 32M
    - Default: 2M
- Truncate current query based on the configuration before inserting into
  `stats_*_processlist` tables.
- Refactor/fix code related to other processlist configurations.
    1. `session_idle_show_processlist` value was not updated in `ProxySQL_Admin.variables`.
    2. Pass processlist config as an argument to `MySQL_Threads_Handler::SQL3_Processlist`
       instead of using thread-local variables.

Signed-off-by: Wazir Ahmed <[email protected]>
Copy link

@renecannao renecannao merged commit 360646b into v3.0 Oct 20, 2025
146 of 154 checks passed
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.

ProxySQL Crash SQLITE_TOOBIG

2 participants