bravecollective / core

Authentication, Authorization, and API Proxy Service
https://core.braveineve.com/
59 stars 45 forks source link

Race condition: character that recently joined corp can have inconsistent data #115

Closed lizthegrey closed 10 years ago

lizthegrey commented 10 years ago

SOUND just had a scare -- someone joined directly from his one-man corp in which he was a director. When we went to pull his keys, he was listed in Core as having director roles and being in alliance, when in fact the director roles were from his previous corp.

dir.evaluate(bb, bbchar) True bbchar EVECharacter(535040092201f2291d0231ca, 111111111, "B----- B------------") bbchar.roles [u'roleDirector'] bb.pull() 2014-04-18 04:01:59,881 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-18 04:01:59,891 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): api.eveonline.com 2014-04-18 04:02:00,415 INFO [brave.core.key.model] pull_full 2014-04-18 04:02:00,418 INFO [brave.core.util.eve] Making query to char.CharacterSheet for key ID 3281465. 2014-04-18 04:02:00,419 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): api.eveonline.com bbchar.roles [u'roleDirector']

I ended up having to manually run this to clear the director roles, and then propagate through the system by manually editing tags.

bbchar.roles = [] bbchar.save()

As of yet, I am unsure whether fault is in the eve api caching being inconsistent, or whether Core removes roles someone no longer has when an api key is re-pulled.

lizthegrey commented 10 years ago

elizabeth@drawbridge:/var/www/irc/install/irc$ sudo grep 'Bobby|3281465' /var/log/supervisor/auth-stderr---supervisor-AbaeDf.log 2014-04-17 20:56:40,287 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-17 20:56:40,827 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-17 20:56:40,829 INFO [brave.core.util.eve] Making query to char.CharacterSheet for key ID 3281465. 2014-04-17 20:56:41,403 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. u'52ffc99d2201f223d36dbbc2\nThu, 17 Apr 2014 20:57:19 GMT\nhttps://auth.of-sound-mind.com/api/core/info/5350402e2201f2291d0231cd\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' 2014-04-17 20:58:01,816 INFO [brave.core.application.controller.grant] REVOKE User(53503fbf2201f2291d0231c6, Bobby Bagodonuss) Application(52ffc99d2201f223d36dbbc2, "SOUND Forums", ApplicationMasks object) u'52ffc99d2201f223d36dbbc2\nThu, 17 Apr 2014 20:58:32 GMT\nhttps://auth.of-sound-mind.com/api/core/info/535040772201f2291d0231d1\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' u'52ffc99d2201f223d36dbbc2\nThu, 17 Apr 2014 21:23:57 GMT\nhttps://auth.of-sound-mind.com/api/core/info/5350466c2201f2291d0231e8\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' 2014-04-17 21:25:26,478 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-17 21:25:26,958 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 21:26:02,828 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-17 21:26:02,842 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 21:30:05,155 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-17 21:30:05,162 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 21:33:07,008 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-17 21:33:07,524 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 21:34:30,714 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-17 21:34:30,721 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 21:38:32,340 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-17 21:38:32,829 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. u'52ffc99d2201f223d36dbbc2\nThu, 17 Apr 2014 21:44:36 GMT\nhttps://auth.of-sound-mind.com/api/core/info/53504b432201f2291d0231f2\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' 2014-04-17 23:20:11,673 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-17 23:20:12,188 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-17 23:20:37,130 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-17 23:20:37,136 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. u'52ffc99d2201f223d36dbbc2\nFri, 18 Apr 2014 00:17:08 GMT\nhttps://auth.of-sound-mind.com/api/core/info/53506f042201f2291d023213\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' u'52ffc99d2201f223d36dbbc2\nFri, 18 Apr 2014 00:17:38 GMT\nhttps://auth.of-sound-mind.com/api/core/info/53506f222201f2291d023216\n{"alliance": null, "tags": [], "corporation": {"name": "Veldspar Villains", "id": 98275930}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' 2014-04-18 00:21:20,469 INFO [brave.core.util.eve] Making query to account.APIKeyInfo for key ID 3281465. 2014-04-18 00:21:20,952 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-18 00:21:54,825 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-18 00:21:54,828 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. 2014-04-18 00:21:54,835 INFO [brave.core.util.eve] Returning cached result of char.CharacterSheet for key ID 3281465. 2014-04-18 00:21:54,846 INFO [brave.core.util.eve] Returning cached result of account.APIKeyInfo for key ID 3281465. u'52ffc99d2201f223d36dbbc2\nFri, 18 Apr 2014 00:24:57 GMT\nhttps://auth.of-sound-mind.com/api/core/info/535070d92201f2291d023220\n{"alliance": {"name": "Of Sound Mind", "id": 99000739}, "tags": ["diplo", "dir", "rites-member", "sr", "verified-member"], "corporation": {"name": "Reasonable People", "id": 1471946311}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}' u'531803eb2201f27528632c72\nFri, 18 Apr 2014 03:50:57 GMT\nhttps://auth.of-sound-mind.com/api/core/info/5350a1202201f2291d023242\n{"alliance": {"name": "Of Sound Mind", "id": 99000739}, "tags": ["diplo", "dir", "rites-member", "sr", "verified-member"], "corporation": {"name": "Reasonable People", "id": 1471946311}, "expires": null, "mask": 0, "character": {"name": "Bobby Bagodonuss", "id": 94004815}}'