Skip to content

fix(bq_driver): Prevent crash when listing datasets for invalid projects#1241

Open
Anshu6250 wants to merge 2 commits into
mainfrom
add_project_fix
Open

fix(bq_driver): Prevent crash when listing datasets for invalid projects#1241
Anshu6250 wants to merge 2 commits into
mainfrom
add_project_fix

Conversation

@Anshu6250
Copy link
Copy Markdown
Collaborator

@Anshu6250 Anshu6250 commented Sep 25, 2025

This PR resolves an issue where the driver would crash when encountering invalid or inaccessible project IDs configured via the "Additional Projects" DSN setting.
image

// Trim leading/trailing whitespace
project_id.erase(0, project_id.find_first_not_of(" \t"));
project_id.erase(project_id.find_last_not_of(" \t") + 1);
project_id.erase(0, project_id.find_first_not_of(" \t\n\r"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please document the code here

@sachinpro
Copy link
Copy Markdown
Collaborator

@shivamd-gpartner @Anshu6250 Is this change still valid?

@shivamd-gpartner shivamd-gpartner marked this pull request as ready for review April 22, 2026 07:07
@shivamd-gpartner shivamd-gpartner requested a review from a team as a code owner April 22, 2026 07:07
Copy link
Copy Markdown
Collaborator

@sachinpro sachinpro left a comment

Choose a reason for hiding this comment

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

A few questions:

  1. If invalid additional project is provided, is the driver throwing an error or crashing?
  2. If an error is sent, what is the error message and for what API?
  3. In case of crash, it cannot be happening at the client SDK level. So we need to fix the client library or the driver.

We will not be introducing any extra validations which impact performance to fix a crash.

@Anshu6250
Copy link
Copy Markdown
Collaborator Author

A few questions:

  1. If invalid additional project is provided, is the driver throwing an error or crashing?
  2. If an error is sent, what is the error message and for what API?
  3. In case of crash, it cannot be happening at the client SDK level. So we need to fix the client library or the driver.

We will not be introducing any extra validations which impact performance to fix a crash.

  1. The driver is throwing an error, not crashing. The trace logs demonstrate that the driver gracefully catches the invalid project and exits the API call, returning a standard -1 (SQL_ERROR) code to the calling host application.

  2. The error is thrown during the SQLTablesW API call. The exact diagnostic error message sent is:
    [HY000] [Google][ODBC BigQuery Driver] [BigQuery] Permanent error, with a last message of Not found: Project anshu (404)

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.

4 participants