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

Panics in case of malformed data #2

Open
stefa168 opened this issue Aug 22, 2024 · 0 comments
Open

Panics in case of malformed data #2

stefa168 opened this issue Aug 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@stefa168
Copy link
Owner

There can be some errors that occur if the data received from the ShineMaster is corrupted or zero-ed out:

2023-12-30T02:09:30.671647Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-02-03T18:48:32.791991Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-02-13T12:23:52.227792Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-02-13T12:34:17.505298Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-02-26T14:07:15.191806Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-02-26T14:17:45.372266Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-03-19T10:56:17.489255Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-03-19T11:16:48.668612Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-03-27T16:12:08.781363Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-03-27T16:17:39.376501Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-04-12T16:37:52.569265Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-04-12T16:48:22.316562Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-04-27T17:23:31.931945Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-04-27T17:34:00.583355Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-05-14T09:57:09.743367Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-05-14T10:47:17.451114Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-05-17T09:37:57.029357Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-05-17T10:03:21.385783Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-05-18T12:39:18.085693Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-05-18T14:09:48.983682Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-06-01T09:09:14.574144Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-06-01T09:29:38.259073Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"
2024-06-08T12:36:34.433127Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Option::unwrap()` on a `None` value" panic.location="src/data_message.rs:102:26"
2024-06-08T13:11:49.988882Z ERROR inverter_data_handler: tracing_panic: A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: \"22021\", message: \"invalid byte sequence for encoding \\\"UTF8\\\": 0x00\", detail: None, hint: None, position: None, where: Some(\"unnamed portal parameter $3\"), schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"mbutils.c\"), line: Some(1665), routine: Some(\"report_invalid_encoding\") })" panic.location="src/server.rs:104:14"

They seem to be related to

  • Invalid date conversion
  • Invalid UTF-8 symbols being saved in the database

A couple of checks should improve the stability. I think I will also add a new field for the entries in the database that made the server error out.

@stefa168 stefa168 added the bug Something isn't working label Aug 22, 2024
@stefa168 stefa168 self-assigned this Aug 22, 2024
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

1 participant