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

send_receive_timeout with value less than 5 causes DB::ParsingException: Unsigned type must not contain '-' symbol. (CANNOT_PARSE_NUMBER) #259

Closed
bnomis opened this issue Oct 25, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@bnomis
Copy link

bnomis commented Oct 25, 2023

This code:

self._progress_interval = str(min(120000, (send_receive_timeout - 5) * 1000))

https://github.com/ClickHouse/clickhouse-connect/blob/15e88b2056d6f1cd53ffbc5094187c4de85db3ab/clickhouse_connect/driver/httpclient.py#L155C1-L155C90

Will cause self._progress_interval to be negative if send_receive_timeout is less than 5.

This negative value is then passed to clickhouse via a http parameter e.g. http_headers_progress_interval_ms=-1000

Clickhouse then returns an error: DB::ParsingException: Unsigned type must not contain '-' symbol. (CANNOT_PARSE_NUMBER)

It could be fixed by:

self._progress_interval = str(max(0, min(120000, (send_receive_timeout - 5) * 1000)))

Also the -5 and 120000 may be better defined as settings and documented.

@bnomis bnomis added the bug Something isn't working label Oct 25, 2023
@genzgd
Copy link
Collaborator

genzgd commented Oct 25, 2023

You are correct, although there really isn't a valid use case for a send/receive timeout of less than 5 seconds.

@genzgd
Copy link
Collaborator

genzgd commented Oct 25, 2023

In addition the progress interval is really designed to keep the connection alive -- especially since the Python HTTP libraries can't actually read the intermediate progress headers. There's no real benefit (or meaningful cost) to changing it and making it configurable again doesn't really have a use case.

@bnomis
Copy link
Author

bnomis commented Oct 25, 2023

I suggest documenting the behavior so others don't run into this issue

@genzgd
Copy link
Collaborator

genzgd commented Oct 26, 2023

The CANNOT_PARSE_NUMBER error is fixed in 0.6.18.

@genzgd genzgd closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants