mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 23:15:49 +03:00
[GH-ISSUE #611] Log entries disappear when the uploaded logfile has a BOM #446
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#446
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rafaelorafaelo on GitHub (Feb 23, 2022).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/611
Hi,

I try to write some powershell code and use
Invoke-RestMethod -Infileto upload a logfile. Powershell creates textfiles with byte order mark https://en.wikipedia.org/wiki/Byte_order_mark When I upload such a file, the complete log entry isn't shown on the checks page.On the screenshot you see entry 42 a /start and entry 43 a ping with a logfile without BOM. Entry 44 is a /start, entry 45 is an invisible ping with a logfile with BOM. The ping is recorded, but it's not shown in the Log. Entry 46 is another /start to show the missing entry 45.
There is no way to let Powershell 5 write the file without BOM. It requires additional code to remove the BOM. Powershell 5 is the default Powershell version on current Windows systems.
Regards,
Ralf
@cuu508 commented on GitHub (Feb 25, 2022):
Thanks for the report!
Are you using the hosted service or self-hosting? If self-hosting, are you on the latest version?
Can you give an example request body (as hex) that triggers this? I tried to reproduce with the following Python snippet but it did not trigger the issue:
@rafaelorafaelo commented on GitHub (Mar 1, 2022):
Hi, I use the latest Docker image from https://hub.docker.com/r/linuxserver/healthchecks
This is my simpe Powershell code.
I get a 500 response, but the check is somehow registered.
Here I remove the BOM and everything works great.
@cuu508 commented on GitHub (Mar 9, 2022):
Thanks for the additional details!
I managed to reproduce the issue. This is already fixed in the current master (by storing ping body in the database as bytes, not as text –
github.com/healthchecks/healthchecks@5ecd625c0b).PS. Healthchecks registers every ping by running two SQL queries:
api_checktable: update last ping time, update the n_pings counterapi_pingtable: store ip, user agent, request body etc.If a request body contains bad UTF8 data, the first query succeeds (this is why the ping gets registered, the counter goes up and monitoring still works), but the second one fails (and you get a HTTP 500 response because of that).
When it comes time to show the ping log, you would see gaps in the numbering: 42, 43, 44, ???, 46. The
api_pingentry for the missing number didn't get saved to the database, and so it doesn't show up in the log.@rafaelorafaelo commented on GitHub (Mar 9, 2022):
thanks for this fix