rust-postgres: windows connection error UTF-8

I setup a postgresql server v13 on my window (mostly to see if it was possible) all default expect for ssl configuration (that work finally) but I end up with a hard error:

Jul 11 01:49:50.720 TRACE mio::poll: registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
Jul 11 01:49:50.780 TRACE tokio_util::codec::framed_impl: flushing framed transport
Jul 11 01:49:50.780 TRACE tokio_util::codec::framed_impl: writing; remaining=44
Jul 11 01:49:50.781 TRACE tokio_util::codec::framed_impl: framed transport flushed
Jul 11 01:49:50.782 TRACE tokio_util::codec::framed_impl: attempting to decode a frame
Jul 11 01:49:50.782 TRACE tokio_util::codec::framed_impl: frame decoded from buffer
Jul 11 01:49:50.783 TRACE tokio_util::codec::framed_impl: flushing framed transport
Jul 11 01:49:50.784 TRACE tokio_util::codec::framed_impl: writing; remaining=81
Jul 11 01:49:50.784 TRACE tokio_util::codec::framed_impl: framed transport flushed
Jul 11 01:49:50.784 TRACE tokio_util::codec::framed_impl: attempting to decode a frame
Jul 11 01:49:50.784 TRACE tokio_util::codec::framed_impl: attempting to decode a frame
Jul 11 01:49:50.785 TRACE tokio_util::codec::framed_impl: frame decoded from buffer
Jul 11 01:49:51.027 TRACE tokio_util::codec::framed_impl: flushing framed transport
Jul 11 01:49:51.027 TRACE tokio_util::codec::framed_impl: writing; remaining=181
Jul 11 01:49:51.027 TRACE tokio_util::codec::framed_impl: framed transport flushed
Jul 11 01:49:51.028 TRACE tokio_util::codec::framed_impl: attempting to decode a frame
Jul 11 01:49:51.038 TRACE tokio_util::codec::framed_impl: attempting to decode a frame
Jul 11 01:49:51.039 TRACE tokio_util::codec::framed_impl: frame decoded from buffer
Jul 11 01:49:51.039 TRACE mio::poll: deregistering event source from poller
Jul 11 01:49:51.039 DEBUG optomata::internal_server_error: Pool { source: Backend(Error { kind: Parse, cause: Some(Custom { kind: InvalidInput, error: Utf8Error { valid_up_to: 34, error_len: Some(1) } }) }) }
Jul 11 01:49:51.040 ERROR optomata::internal_server_error: Pool: An error occured while creating a new object: error parsing response from server: invalid utf-8 sequence of 1 bytes from index 34

I use deadpool but that unrelated, I’m unaware of a PostgreSQL option for internal protocol encoding. The same code work for a linux server.

HS: don’t do like me it’s a nightmare

I did run the test of tokio-postgresql:

---- custom_array stdout ----
thread 'custom_array' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Db, cause: Some(DbError { severity: "ERREUR", parsed_severity: Some(Error), code: SqlState(E42704), message: "le type « hstore[] » n'existe pas", detail: None, hint: None, position: Some(Original(12)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("d:\\pginstaller_13.auto\\postgres.windows-x64\\src\\backend\\parser\\parse_type.c"), line: Some(274), routine: Some("typenameType") }) }', tokio-postgres\tests\test\main.rs:193:62
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- md5_password_ok stdout ----
thread 'md5_password_ok' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Parse, cause: Some(Custom { kind: InvalidInput, error: Utf8Error { valid_up_to: 4, error_len: Some(1) } }) }', tokio-postgres\tests\test\main.rs:32:53

---- notices stdout ----
thread 'notices' panicked at 'assertion failed: `(left == right)`
  left: `"l'identifiant « xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx » sera tronqué en « xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx »"`,
 right: `"identifier \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" will be truncated to \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\""`', tokio-postgres\tests\test\main.rs:604:5

---- md5_password_wrong stdout ----
thread 'md5_password_wrong' panicked at 'error parsing response from server: invalid utf-8 sequence of 1 bytes from index 4', tokio-postgres\tests\test\main.rs:73:19

---- pipelined_prepare stdout ----
thread 'pipelined_prepare' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Db, cause: Some(DbError { severity: "ERREUR", parsed_severity: Some(Error), code: SqlState(E42704), message: "le type « hstore[] » n'existe pas", detail: None, hint: None, position: Some(Original(12)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("d:\\pginstaller_13.auto\\postgres.windows-x64\\src\\backend\\parser\\parse_type.c"), line: Some(274), routine: Some("typenameType") }) }', tokio-postgres\tests\test\main.rs:111:66

---- plain_password_ok stdout ----
thread 'plain_password_ok' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Parse, cause: Some(Custom { kind: InvalidInput, error: Utf8Error { valid_up_to: 4, error_len: Some(1) } }) }', tokio-postgres\tests\test\main.rs:32:53

---- plain_password_wrong stdout ----
thread 'plain_password_wrong' panicked at 'error parsing response from server: invalid utf-8 sequence of 1 bytes from index 4', tokio-postgres\tests\test\main.rs:51:19

---- scram_password_wrong stdout ----
thread 'scram_password_wrong' panicked at 'error parsing response from server: invalid utf-8 sequence of 1 bytes from index 4', tokio-postgres\tests\test\main.rs:95:19

---- scram_password_ok stdout ----
thread 'scram_password_ok' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Parse, cause: Some(Custom { kind: InvalidInput, error: Utf8Error { valid_up_to: 4, error_len: Some(1) } }) }', tokio-postgres\tests\test\main.rs:32:53

---- types::test_hstore_params stdout ----
thread 'types::test_hstore_params' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Db, cause: Some(DbError { severity: "ERREUR", parsed_severity: Some(Error), code: SqlState(E42704), message: "le type « hstore » n'existe pas", detail: None, hint: None, position: Some(Original(16)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("d:\\pginstaller_13.auto\\postgres.windows-x64\\src\\backend\\parser\\parse_type.c"), line: Some(274), routine: Some("typenameType") }) }', tokio-postgres\tests\test\types\mod.rs:46:14

---- types::test_citext_params stdout ----
thread 'types::test_citext_params' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Db, cause: Some(DbError { severity: "ERREUR", parsed_severity: Some(Error), code: SqlState(E42704), message: "le type « citext » n'existe pas", detail: None, hint: None, position: Some(Original(87)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("d:\\pginstaller_13.auto\\postgres.windows-x64\\src\\backend\\parser\\parse_type.c"), line: Some(274), routine: Some("typenameType") }) }', tokio-postgres\tests\test\types\mod.rs:276:10
SHOW SERVER_ENCODING;
result to:
 server_encoding
-----------------
 UTF8
(1 ligne)

I have no idea if support windows is a goal or not.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (7 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like the issue is with Postgres’s French locale. The error message is not valid UTF-8:

Raw escaped bytes:

\x61\x75\x74\x68\x65\x6e\x74\x69\x66\x69\x63\x61\x74\x69\x6f
\x6e\x20\x70\x61\x72\x20\x6d\x6f\x74\x20\x64\x65\x20\x70\x61\x73
\x73\x65\x20\xe9\x63\x68\x6f\x75\xe9\x65\x20\x70\x6f\x75\x72\x20
\x6c\x27\x75\x74\x69\x6c\x69\x73\x61\x74\x65\x75\x72\x20\x20\xab
\x20\x6f\x70\x74\x6f\x6d\x61\x74\x61\x20\xbb\x00

String::from_utf8_lossy decode:

authentification par mot de passe �chou�e pour l'utilisateur  � optomata �

Note the �s, indicating an invalid UTF-8 byte sequence.