eveseat / seat

🌀✳️ SeAT: A Simple, EVE Online API Tool and Corporation Manager
https://eveseat.github.io/docs/
GNU General Public License v2.0
434 stars 142 forks source link

Delay Jobs after getting 403 response codes from ESI #545

Closed jediefe closed 4 years ago

jediefe commented 5 years ago
warlof commented 5 years ago

Hi @jediefe,

How many users and workers do you have on your setup?

Such things are normally properly handled by both eseye and job preflight.

jediefe commented 5 years ago

Hi @warlof my instance currently has around 760 users and 40 workers running.

warlof commented 5 years ago

Jesus Christ, can you lower your worker amount as an initial mitigation?

I don't think you need as much for such amount of users, really 😐

jediefe commented 5 years ago

I reduced to 16 and besides the fact that updating characters takes about 10 mins now (~40k jobs) i still receive a similar amount of errors. :man_shrugging:

herpaderpaldent commented 5 years ago

@warlof what would speak against retry=3 && if 420 hitted delay?

warlof commented 5 years ago

I'll build a stats board based on endpoint and remaining hits which will be more accurate.

The problem isn't the retry but the fact we're reaching the limit apparently (which is weird since it's normally supported properly with eseye).

That structure endpoint is really not helping at all to mitigate such issue.

@jediefe what's the last endpoint which return you an error before 420 start except the structure endpoint?

herpaderpaldent commented 5 years ago

We have a saying in german: "Das eine tun und das andere nicht lassen" which translates smth to: "'doing one thing without abandoning the other'" (réaliser l'un et ne pas lâcher l'autre) ... maybe we could think of delaying jobs which are not /universe/structure after a 420?

Yes it is very true and correct that we try to prevent hitting the error limit, but if it happens we could try to do it just a tiny little bit later?

Maybe to think of: 100 errors in 60 seconds. With 16 workers means roughly hitting 6 errors each in 60 seconds. Which could happen with a large set of unresolved structures or a 1-2 sets of missing refresh_tokens (which haven't been invalidated yet).

jediefe commented 5 years ago

Hey guys, just a short notice that I'm busy IRL at the moment and will come back later to you. Thanks for the feedback so far.

jediefe commented 5 years ago

Hey @warlof I've scraped through the last API fetch for this and found v2/universe/structures/<id> throwing a 403 error right before the first 420 kicks in.

Here are three lines from the log:

[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/v2/characters/93187550/skillqueue/?datasource=tranquility [t/e: 0.24s/2]
[2019-03-28 15:01:36] eseye.ERROR: [http 403, forbidden] get -> https://esi.evetech.net/v2/universe/structures/1027847407689/?datasource=tranquility [t/e: 0.11s/1]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1021160190583/?datasource=tranquility [t/e: 0.18s/0]
warlof commented 5 years ago

Except the structure endpoint?

jediefe commented 5 years ago

Yep, this is the paste of further upcoming lines from the same log:

[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/v2/characters/93187550/skillqueue/?datasource=tranquility [t/e: 0.24s/2]
[2019-03-28 15:01:36] eseye.ERROR: [http 403, forbidden] get -> https://esi.evetech.net/v2/universe/structures/1027847407689/?datasource=tranquility [t/e: 0.11s/1]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1021160190583/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93187550/wallet/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1027847404796/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.15s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/v1/characters/93187550/attributes/?datasource=tranquility [t/e: 0.32s/2]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.17s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1029833409281/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1027847403190/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.23s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1029851936015/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1027847408745/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.16s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/universe/structures/1029901670793/?datasource=tranquility [t/e: 0.04s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.22s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.29s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.24s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/v4/characters/93187550/skills/?datasource=tranquility [t/e: 0.43s/1]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.16s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.15s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.17s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v3/characters/93188039/clones/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.16s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v4/characters/93188039/notifications/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.19s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/calendar/?datasource=tranquility [t/e: 0.17s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.20s/]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.19s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/characters/93188039/fittings/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/contracts/?datasource=tranquility&page=1 [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/fatigue/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/characters/93188039/contacts/?datasource=tranquility&page=1 [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/mining/?datasource=tranquility&page=1 [t/e: 0.17s/0]
[2019-03-28 15:01:36] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.22s/]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/industry/jobs/?datasource=tranquility&include_completed=1 [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/killmails/recent/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:36] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v2/characters/93188039/online/?datasource=tranquility [t/e: 0.17s/0]
[2019-03-28 15:01:37] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/location/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:37] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.21s/]
[2019-03-28 15:01:37] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.21s/]
[2019-03-28 15:01:37] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/ship/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:37] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/mail/?datasource=tranquility [t/e: 0.18s/0]
[2019-03-28 15:01:37] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.17s/]
[2019-03-28 15:01:37] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.22s/]
[2019-03-28 15:01:37] eseye.INFO: [http 200, ok] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.20s/]
[2019-03-28 15:01:37] eseye.ERROR: [http 420, status code 420] get -> https://esi.evetech.net/v1/characters/93188039/mail/lists/?datasource=tranquility [t/e: 0.18s/0]

Only the structure endpoints return 403, all other endpoints are working.

warlof commented 5 years ago

So prior to 15:01 you didn't have any single status starting with either 4 or 5?

jediefe commented 5 years ago

No, the structure endpoints throw 403 right from the start (at 15:00 in this case) for each requested structure the respective member lacks access rights for it in the game. So in theory this means, the more assets members have on structures with no access, the more errors are thrown.

Do you need more log?

warlof commented 4 years ago

It has been improved in SeAT 4.0.x with three job middlewares. One will check Tranquility status, the other will check check ESI status and Rate Limit.

https://github.com/eveseat/eveapi/blob/4.0.x/src/Jobs/Middleware/CheckEsiRateLimit.php https://github.com/eveseat/eveapi/blob/4.0.x/src/Jobs/Middleware/CheckEsiStatus.php https://github.com/eveseat/eveapi/blob/4.0.x/src/Jobs/Middleware/CheckServerStatus.php