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

HTTP body in RowBinary format started with BOM (0xEFBBBF) leads to Cannot read all data #37420

Closed
loyd opened this issue May 22, 2022 · 0 comments · Fixed by #37428
Closed

HTTP body in RowBinary format started with BOM (0xEFBBBF) leads to Cannot read all data #37420

loyd opened this issue May 22, 2022 · 0 comments · Fixed by #37428
Labels
potential bug To be reviewed by developers and confirmed/rejected.

Comments

@loyd
Copy link
Contributor

loyd commented May 22, 2022

You have to provide the following information whenever possible.

Batches started with 0xEFBBBF cannot be inserted in the RowBinary format using HTTP.

A clear and concise description of what works not as it is supposed to.

Does it reproduce on recent release?

On the latest available on the docker hub, 22.1.3 revision 54455.

How to reproduce

  1. Create a table:
CREATE TABLE some(no UInt64) ENGINE = MergeTree ORDER BY no;
  1. Write 1653178571234567890:
echo -en '\xd2\x66\xb9\xd0\x26\x45\xf1\x16' | curl -v --data-binary @- 'http://127.0.0.1:8123/?query=INSERT%20INTO%20some(no)%20FORMAT%20RowBinary'
*   Trying 127.0.0.1:8123...
* Connected to 127.0.0.1 (127.0.0.1) port 8123 (#0)
> POST /?query=INSERT%20INTO%20some(no)%20FORMAT%20RowBinary HTTP/1.1
> Host: 127.0.0.1:8123
> User-Agent: curl/7.83.0
> Accept: */*
> Content-Length: 8
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Sun, 22 May 2022 00:53:08 GMT
< Connection: Keep-Alive
< Content-Type: text/plain; charset=UTF-8
< X-ClickHouse-Server-Display-Name: 4f17bcf5935b
< Transfer-Encoding: chunked
< Keep-Alive: timeout=3
< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"}
<
* Connection #0 to host 127.0.0.1 left intact

Works fine.

  1. Write 1651760768976141295 (actually, any number started with 0xEFBBBF):
echo -en '\xef\xbb\xbf\x00\xab\x3b\xec\x16' | curl -v --data-binary @- 'http://127.0.0.1:8123/?query=INSERT%20INTO%20some(no)%20FORMAT%20RowBinary'
*   Trying 127.0.0.1:8123...
* Connected to 127.0.0.1 (127.0.0.1) port 8123 (#0)
> POST /?query=INSERT%20INTO%20some(no)%20FORMAT%20RowBinary HTTP/1.1
> Host: 127.0.0.1:8123
> User-Agent: curl/7.83.0
> Accept: */*
> Content-Length: 8
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Date: Sun, 22 May 2022 00:54:26 GMT
< Connection: Keep-Alive
< Content-Type: text/plain; charset=UTF-8
< X-ClickHouse-Server-Display-Name: 4f17bcf5935b
< Transfer-Encoding: chunked
< X-ClickHouse-Exception-Code: 33
< Keep-Alive: timeout=3
< X-ClickHouse-Summary: {"read_rows":"0","read_bytes":"0","written_rows":"0","written_bytes":"0","total_rows_to_read":"0"}
<
Code: 33. DB::Exception: Cannot read all data. Bytes read: 5. Bytes expected: 8.: (at row 1)
: While executing BinaryRowInputFormat. (CANNOT_READ_ALL_DATA) (version 22.1.3.7 (official build))
* Connection #0 to host 127.0.0.1 left intact
@loyd loyd added the potential bug To be reviewed by developers and confirmed/rejected. label May 22, 2022
@loyd loyd changed the title Some UInt64 values cannot be inserted in RowBinary format over HTTP Batches started with 0xEF cannot be inserted in RowBinary format over HTTP May 22, 2022
@loyd loyd changed the title Batches started with 0xEF cannot be inserted in RowBinary format over HTTP Batches started with 0xEFBBBF cannot be inserted in RowBinary format over HTTP May 22, 2022
@loyd loyd changed the title Batches started with 0xEFBBBF cannot be inserted in RowBinary format over HTTP HTTP body in RowBinary format started with BOM (0xEFBBBF) leads to Cannot read all data May 22, 2022
loyd added a commit to loyd/ClickHouse that referenced this issue Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug To be reviewed by developers and confirmed/rejected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant