Skip to content
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

Fixed silent error occurrence on 200 http status code (ExceptionWhileProcessing query error) #205

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

anathex
Copy link
Contributor

@anathex anathex commented Jan 16, 2024

Fixes issue #144

This problem occurs on partially flushed response to the client with 200 status code with further ClickHouse exception.
All details in StatementTest::testIsErrorWithOkStatusCode

I've used preg_match instead of stripos (suggested in #144) because regexes precompiles and further calls are much cheaper (about 10 times in my tests of clickhouse error regex). Also stripos speed only 30% faster (and less) than first call of preg_match on string from 10MB to 1000MB.

@anathex anathex changed the title Fixed silent error occurrence on 200 status code (ExceptionWhileProcessing issue) Fixed silent error occurrence on 200 http status code (ExceptionWhileProcessing issue) Jan 16, 2024
@anathex anathex changed the title Fixed silent error occurrence on 200 http status code (ExceptionWhileProcessing issue) Fixed silent error occurrence on 200 http status code (ExceptionWhileProcessing query error) Jan 16, 2024
@anathex
Copy link
Contributor Author

anathex commented Jan 16, 2024

This solution still has a caveat that result of correct query like this will be considered as error:
SELECT exception FROM system.query_log WHERE event_date = '2024-01-16' AND exception_code > 0 LIMIT 10;

In my opinion that in real life applications this kind of query is less likely to occur than silent "error" on not sufficient memory during query execution. After all having explicit error is much better than silent "successful" query, that might be causing unpleasant side-effects in business logic.

@isublimity isublimity merged commit a629f30 into smi2:master Jan 18, 2024
1 check 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.

2 participants