PhlexPlexico / G5API

An express API for CS2 Servers using MatchZy and PugSharp to record and manage matches.
MIT License
96 stars 31 forks source link

URLs not being set properly #252

Closed PhlexPlexico closed 1 year ago

PhlexPlexico commented 1 year ago
          this is a piece of the log with an error that was in the previous API, the API logs are fine, there are no errors

BNK#3: !r L 06/24/2023 - 18:27:12: "BNK#3<3>" say "!r" *src/common/httpclient.cpp (808) : pHost && pHost** src/common/httpclient.cpp (808) : pHost && *pHost L 06/24/2023 - 18:27:12: [get5.smx] Event HTTP request failed due to a network or configuration error. Make sure you have enclosed your event URL in quotes. BNK#1: !r L 06/24/2023 - 18:27:26: "BNK#1<6>" say "!r" *src/common/httpclient.cpp (808) : pHost && pHost** src/common/httpclient.cpp (808) : pHost && *pHost L 06/24/2023 - 18:27:26: [get5.smx] Event HTTP request failed due to a network or configuration error. Make sure you have enclosed your event URL in quotes.

Originally posted by @Bunker56 in https://github.com/PhlexPlexico/G5API/issues/251#issuecomment-1605613350

Bunker56 commented 1 year ago

The latest g5api:next (Wingman match) Screenshot_20 https://g5test.bunker56.ru/match/1 csgoserver-console.log errors_20230627.log G5API-error-0.log G5API-out-0.log L20230627.log

PhlexPlexico commented 1 year ago

Okay, some more logging has been put in the app to find this rogue addition of kills. It appears headshot kills is working just fine, but regular kills isn't. Please pull from next in 10 minutes and see if we can find out where this is being set :)

Bunker56 commented 1 year ago

Screenshot_21 csgoserver-console.log errors_20230627.log G5API-error-0.log G5API-out-0.log L20230627.log

PhlexPlexico commented 1 year ago

Okay, I think this may be coming down to a concurrency issue. I've added much more logging because I was unable to find the same result via Postman. Would you mind trying to run one last match and see if we can squash this bug? Worst case, I may take out the player stats update on death.

Bunker56 commented 1 year ago

Just a moment... Screenshot_22

csgoserver-console.log errors_20230628.log G5API-error-0.log G5API-out-0.log L20230628.log

PhlexPlexico commented 1 year ago

Okay, so it's looking like this is largely a concurrency issue with the round ending and players dying. I'll have to remove the calls to the player_stats updates during the OnPlayerDeath as this should fix the issue.

Also, as an aside, I see you're running into the error [get5] Not uploading backup file as no URL was set. - do you have get5_remote_backup_url set anywhere in your server config to nothing? Since the demo is uploading, the remote backups should work as well.

I'll let you know as soon as I have the patch out.

PhlexPlexico commented 1 year ago

Okay, next should be available in 10 minutes from now, and it should work as expected (I hope)!

Bunker56 commented 1 year ago

One more question is what kind of branch to use to build the g5v? master or wingman?

PhlexPlexico commented 1 year ago

Just use master, the wingman branch was merged into it a few days ago

Bunker56 commented 1 year ago

I played another series, it was noticed that after the end of the first round, statistics are written normally, but at the end of the second, the value of kills increases by 1. A little later I will clean the logs, replay again and send the result....

PhlexPlexico commented 1 year ago

Well, did the user kill someone while you were looking? OnPlayerDeath will update the stats and automatically report it to the front end, providing love updates.

Bunker56 commented 1 year ago

I played alone on two computers, so someone's interference is excluded...

Bunker56 commented 1 year ago

and could it be a bug of get5? which version is better to use? I have 0.14.7 now. try to compile from the development branch?

PhlexPlexico commented 1 year ago

0.14.7 is the exact same as development, so there are no differences.

Bunker56 commented 1 year ago

I have now played two matches in a row with the same parameters, got interesting results... https://g5test.bunker56.ru/match/14 Screenshot_23 https://g5test.bunker56.ru/match/15 Screenshot_24 csgoserver-console.log errors_20230629.log G5API-error-0.log G5API-out-0.log L20230629.log

PhlexPlexico commented 1 year ago

Okay, I've removed some more calls to inserting on playerstats. I think this is possibly a concurrency issue with the database doing inserts and when the API receives the call. Please try one last time :)

PhlexPlexico commented 1 year ago

It definitely has to do with order of events. When the player dies, has he planted the bomb prior to?

Bunker56 commented 1 year ago

When the player dies, has he planted the bomb prior to?

No, he's not doing anything, he's just standing there.

PhlexPlexico commented 1 year ago

Okay well make sure your API is updated, since I removed any inserts that just insert deaths. So I believe that shouldn't happen anymore.

Bunker56 commented 1 year ago

Hi! I probably owe you an apology for making you tense up. But I still didn't understand what the problem might be. I just transferred the API to a computer with CS GO servers, checked all the settings again, and, miraculously, everything works... It is possible that Debian 12 is installed on the computer where the API was installed, although I do not know if this is because of this. But on Debian 11 it seems to work without problems. Once again, I apologize for the inconvenience caused ... the image next works fine, statistics seem to be written without problems. I will try to play BO3, BO5, then I will report the results...

PhlexPlexico commented 1 year ago

Hey no worries! I'm sure there is still some concurrency issues based on what is being received, as you can see in the logs there's a few post calls line up close enough... Would you mind if I revert my changes to insert playerstats on death again and see if that works?

Thanks!

Bunker56 commented 1 year ago

You're welcome! But I'll probably still have to save the current next image...

Bunker56 commented 1 year ago

I played BO 1, BO3, standard and wingman - everything works fine, statistics are written normally. And strangely enough, after transferring the API to the CS GO server, the maps stop freez... Strange, but a fact.

PhlexPlexico commented 1 year ago

Well, it's a small change, it should only update if the playerstats record exists, so there shouldn't be any errors.

Bunker56 commented 1 year ago

pull new next?

PhlexPlexico commented 1 year ago

Yes please!

Bunker56 commented 1 year ago

Let`s try. :)

Bunker56 commented 1 year ago

Cheating again... :)

Screenshot_30 csgoserver-console.log errors_20230630.log G5API-error-0.log G5API-out-0.log L20230630.log

PhlexPlexico commented 1 year ago

Hmmm interesting, alright we'll remove that and call it a day then!

Bunker56 commented 1 year ago

it seems to me that statistics will be quite enough for the frontend, for those who want a more capacious one, there is a plugin for MySQL.

Bunker56 commented 1 year ago

Only backups are not written, everything else seems to work

Bunker56 commented 1 year ago

Perfectly!.. I can safely switch to a new API

Screenshot_33 Screenshot_34

PhlexPlexico commented 1 year ago

Perfect, again thanks for bearing with all the testing! :)

Bunker56 commented 1 year ago

You are always welcome, if you need anything, I am at your service

Bunker56 commented 1 year ago

Hi! One more question... I have not tried to use the backup system yet, and I would like to know if it is being used or if the functionality is not yet available?

PhlexPlexico commented 1 year ago

It should be available, just ensure that you don't set get5_remote_backup_url anywhere in your server configs. G5API automatically sets it itself and will backup game states under public/backups.

I noticed in your logs it was saying it was unset, but this should not be the case, so double check all your configs that you don't set it somewhere else by mistake :)

Bunker56 commented 1 year ago

Game states under public/backups are not created, but they are essentially not needed after the match. During the match, everything works fine, backups are functioning, Config get5 is default.

Bunker56 commented 1 year ago

Is this how it should be?

code: 'ER_BAD_FIELD_ERROR', errno: 1054, sql: "INSERT INTO match_bomb_plants SET match_id = '23', map_id = 25, player_stats_id = 54, round_number = 0, round_time = 40656, site = 'a', defused = true, bomb_time_remaining = 18430", sqlState: '42S22', sqlMessage: "Unknown column 'bomb_time_remaining' in 'field list'"

G5API-error-0.log G5API-out-0.log

PhlexPlexico commented 1 year ago

Game states under public/backups are not created, but they are essentially not needed after the match. During the match, everything works fine, backups are functioning, Config get5 is default.

Yeah but there are remote backups that get5 will send to a web server every round. In the event of a server being unstable/crashing, you would be able to load the backup from the API server onto a new game server and continue from there. I may have to do some testing by myself to ensure this is working.

I've seen in your game server logs when it tries to write a backup it says that the get5_remote_backup_url is not set, even though the API sets it the same time the demo values are set. Could you start a game, pause it, and use the game server console to take a look at that value?

Is this how it should be?

code: 'ER_BAD_FIELD_ERROR', errno: 1054, sql: "INSERT INTO match_bomb_plants SET match_id = '23', map_id = 25, player_stats_id = 54, round_number = 0, round_time = 40656, site = 'a', defused = true, bomb_time_remaining = 18430", sqlState: '42S22', sqlMessage: "Unknown column 'bomb_time_remaining' in 'field list'"

G5API-error-0.log G5API-out-0.log

Yup looks like I forgot to include that column after testing, should be available shortly.

Bunker56 commented 1 year ago

image g5api:2.0.1.1 Get5 config is default

Screenshot_35

csgoserver-console.log errors_20230701.log G5API-error-0.log G5API-out-0.log L20230701.log

PhlexPlexico commented 1 year ago

Ah sorry, I forgot to add, can you also check the get5_remote_backup_header_key and get5_remote_backup_header_value? It seems your game server is replacing this value, I would check your live.cfg, warmup.cfg and knife.cfg, as well as your server.cfg to ensure this value is not getting unset.

PhlexPlexico commented 1 year ago

There, found out there was a get5 bug. Fixed the issue on my end with better practices in place, so now it should work as intended :)

You should be able to pull 2.0.2.0 or latest and everything should work, along with more security on the config page

Bunker56 commented 1 year ago

I'm going to try it now... 20 minutes...

Bunker56 commented 1 year ago

What`s about get5 0.15?

PhlexPlexico commented 1 year ago

It's an update to fix some issues with cvars being stored/not stored. You should just update to it just to be on latest

Bunker56 commented 1 year ago

0.14.7 works, 0.15 for some reason did not start match... Let me run in a new image first from 0.14, and later I'll start 0.15. There is simply no way right now...

PhlexPlexico commented 1 year ago

Oop thanks for the heads up, missed a check on a version. New version should be out soon!

Bunker56 commented 1 year ago

already out... or are you talking about api?

PhlexPlexico commented 1 year ago

Nah, it appears to still be building :) 5 more minutes and it should be good!

https://github.com/PhlexPlexico/G5API/actions/runs/5432643900/jobs/9879823288

Bunker56 commented 1 year ago

Yeah. I see.