MegaAntiCheat / client-backend

GNU General Public License v3.0
120 stars 25 forks source link

Error 422 on late bytes upload #175

Closed megascatterbomb closed 3 months ago

megascatterbomb commented 4 months ago

Several users have reported intermittent 422 errors when uploading the late bytes.

image

Not critical as it doesn't affect our ability to parse the demo (it can even be played back in TF2 still), but still worth investigating.

jayceslesar commented 4 months ago

I am seeing this a bunch -- seems wack

"POST /late_bytes?api_key=some_api_key HTTP/1.1" 422 Unprocessable Entity
jayceslesar commented 4 months ago

I think if we make this logic better in terms of verbosity when it matters we will get some more info https://github.com/MegaAntiCheat/masterbase/blob/main/masterbase/app.py#L383

jayceslesar commented 3 months ago

there seems to be no rhyme or reason with patterns for a given api key -- some will succeed and others will fail

JoshuaVandaele commented 3 months ago

Could this be related to the "Auto-delete recordings" option? image

megascatterbomb commented 3 months ago

Could this be related to the "Auto-delete recordings" option? image

I've encountered this error a few times myself and I don't have that setting checked.

jayceslesar commented 3 months ago

I am struggling to reproduce locally

jayceslesar commented 3 months ago

The only way it would fail validation is if the body isnt a string

jayceslesar commented 3 months ago

reference https://github.com/MegaAntiCheat/client-backend/blob/main/src/masterbase.rs#L232

jayceslesar commented 3 months ago

This smells like a race condition on the DB/filesystem side as I cannot reproduce with what I believe to be valid data

jayceslesar commented 3 months ago

note that we return a 422 if we get an error when attempting to close the late bytes out ... https://github.com/MegaAntiCheat/masterbase/blob/main/masterbase/app.py#L128

likely we are hitting https://github.com/MegaAntiCheat/masterbase/blob/main/masterbase/lib.py#L559 but I just added logs to show more detail

jayceslesar commented 3 months ago

yes is indeed a race condition on the backend. Closing this issue and will eventually reproduce and fix

Familex commented 3 months ago

got these errors too:

2024-08-13T05:26:32.011520Z  INFO client_backend::demo: Opened new demo session with Masterbase: DemoSession(229295141473228488338479370295583856718)
2024-08-13T06:04:35.083956Z ERROR client_backend::demo: Failed to upload late bytes to masterbase: Server returned 422
2024-08-13T06:04:37.021542Z  INFO client_backend::masterbase: Closed session 229295141473228488338479370295583856718.
2024-08-13T06:05:08.936735Z  INFO client_backend::demo: Opened new demo session with Masterbase: DemoSession(312197181810514410830725529466809385660)
2024-08-13T06:31:51.085087Z ERROR client_backend::demo: Failed to upload late bytes to masterbase: Server returned 422
2024-08-13T06:31:52.835987Z  INFO client_backend::masterbase: Closed session 312197181810514410830725529466809385660.