oracle-devrel/leagueoflegends-optimizer

Frequent random "Failed to establish a new connection: [Errno -2] Name or service not known" errors while using "src/league.py"

d8elessar opened this issue · 2 comments

Hi,
I started the "League of Legends Machine Learning with OCI - Data Extraction" Labs early this week, following every step, but I can't move from Lab 3 since I can't import data due to "Failed to establish a new connection: [Errno -2] Name or service not known" errors.

I get this error with both player_list and match_list modes used in Task 1 of Lab 3.
Sometimes this error shows immediately, sometimes it runs for 1 or 2 minutes and then the exception shows... It shows at a random time, but it shows every time I run these modes.

And when I try to run Task 2 of Lab 3 ("python src/league.py --mode="match_download_detail" "), it doesn't return an error but it never finds anything (maybe because there is not enough data from Task 1 of Lab 3, I don't know).

Console log example (error at the bottom):

alex_evol@cloudshell:~ (eu-madrid-1)$ ssh opc@143.47.50....
FIPS mode initialized
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Thu Mar 9 12:15:43 2023 from 143.47.50....
[opc@lol0 ~]$ python src/league.py --mode "player_list"
Connection successful.
2023-03-09 12:40 Region: br1 | Tier: CHALLENGER | Queue: RANKED_SOLO_5x5 | Total Players: 200
2023-03-09 12:40 Region: br1 | Tier: GRANDMASTER | Queue: RANKED_SOLO_5x5 | Total Players: 500
2023-03-09 12:40 Region: br1 | Tier: MASTER | Queue: RANKED_SOLO_5x5 | Total Players: 4432
2023-03-09 12:41 Total users obtained in region br1 and queue RANKED_SOLO_5x5: 5132
2023-03-09 12:41 Summoner Hxssx already inserted
2023-03-09 12:41 Summoner paiN anato already inserted
2023-03-09 12:41 Summoner paiN Damage1 already inserted
2023-03-09 12:41 Summoner LOS CrjaY already inserted
(edited because the log was too long)
2023-03-09 12:42 Summoner é o sleepy already inserted
2023-03-09 12:42 Summoner Daemon V already inserted
2023-03-09 12:42 Summoner Gorenicolt already inserted
2023-03-09 12:42 Summoner RISE Anyyy already inserted
2023-03-09 12:42 Summoner Alanzinhö already inserted
2023-03-09 12:42 Summoner zynts06 already inserted
[DBG] INSERT {'summonerId': 'zfb9b-kE5PfYV3_4VsavBVt7dIfjmtgDYqEf3K9fdSem4fk', 'summonerName': 'cristalszinha ', 'leaguePoints': 664, 'rank': 'I', 'wins': 151, 'losses': 143, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'GRANDMASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'F-s2T9GhradWzKDP7CwAzX-lnvEqx3mDD4ciukaWYf15OiJVLUHvS7fUqsukrPuj3S7cU79Uzye7pQ'} OK
2023-03-09 12:42 Inserted new summoner: cristalszinha in region br1, queue RANKED_SOLO_5x5
2023-03-09 12:42 Summoner Letal Akshan already inserted
[DBG] INSERT {'summonerId': 'qfuPe6Xyc6ehXQBtY7dmbUaG_l1H-dB6Jic-oiD-B4KFG5c', 'summonerName': 'soup of makako', 'leaguePoints': 284, 'rank': 'I', 'wins': 73, 'losses': 67, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'Igze0FtrDBoXLfOTjsONKb-ANprIpPu1sxeKaoimaTVJL9aogmiwowJSaijeIS9vUQPs0hLvaQfYVQ'} OK
2023-03-09 12:42 Inserted new summoner: soup of makako in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'YxQ-lracrNuGacEYmFxbvdc158uFL3x5psZnzb7AHNN5pobnf8uUEiO7kQ', 'summonerName': 'Nonagésimo Nono', 'leaguePoints': 262, 'rank': 'I', 'wins': 114, 'losses': 96, 'veteran': True, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'dFX9HKpQs2eWtlwXHfAsK59ZfAF2hjQOsOOJSseFiDrR7N35QJwBad9_xkqwM1yZFrfkQwuiqRQkWw'} OK
2023-03-09 12:42 Inserted new summoner: Nonagésimo Nono in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'Xo7ClPQxCGovVjVKspDwCMkgDDtSqAlsNFOMTj3X3u6H', 'summonerName': 'Risadinh4', 'leaguePoints': 0, 'rank': 'I', 'wins': 53, 'losses': 56, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'le7ztwjGq37r4RLc7J1UtDDYM54yxCVKDYUecpumIn5gBYkPgnAu_BjPPp2H9NEgFFK0JHju0OI5Uw'} OK
2023-03-09 12:42 Inserted new summoner: Risadinh4 in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'erqeMLN25gBNYGdaF25vpEhs4UBWCF5iUPRTc-nbXEaj4KE', 'summonerName': 'Mike Das Ruas', 'leaguePoints': 139, 'rank': 'I', 'wins': 57, 'losses': 38, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'Uek56Az4FpG5tT2MGgdSGzJLYmlxHqXEzHJlGBYNJMNKcSmOqs2lorUH_GKcECvsCfA93BJdNaYD_g'} OK
2023-03-09 12:42 Inserted new summoner: Mike Das Ruas in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 't8Kih1FzmuxOoP7tIB_QJscpzKJgXf4_Z4IDr4gwgQNZ_XOPthbIEZNH7Q', 'summonerName': 'Rendowney', 'leaguePoints': 287, 'rank': 'I', 'wins': 109, 'losses': 85, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'CPnfW_Bjv7IwEIGQb-2ldpGelkh0oEag5_Ha4sEKSzS8KsP8K4tNg02w14J1L3fAOYMQDrNMTOOocw'} OK
2023-03-09 12:42 Inserted new summoner: Rendowney in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'FlbmN9UGKLFEwE--Czrh1r3NbQ9PvIg1obyy4nfahiGEIg', 'summonerName': 'The Pursuer', 'leaguePoints': 27, 'rank': 'I', 'wins': 204, 'losses': 188, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': '7CQQOc6IpG3wjsj9rZFXTihtTWt1qpTV9s-lb89SAkRYgNY6HImI8y4T32wIuIB1pmyE3Tz2ZFygWQ'} OK
2023-03-09 12:42 Inserted new summoner: The Pursuer in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'SLDiKWHi4Rq8rF6xXGoEcaGbTd1gj4ssg2wYd7ZE-3f-Vg', 'summonerName': 'Badsalazar', 'leaguePoints': 12, 'rank': 'I', 'wins': 104, 'losses': 96, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'bwmCEhiRfwaY1wEHGAu3N1hYnoxmyEv8Fe-VmZeRVxmXunFpEtMOOB4MwjWmOkdWBexz-QBIP-4kCw'} OK
2023-03-09 12:43 Inserted new summoner: Badsalazar in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'qIK4IrMyEbLXjRXxJb7W8G8MolCAfuTnMqOOdREIpKJKBcs', 'summonerName': 'crush my heart', 'leaguePoints': 32, 'rank': 'I', 'wins': 130, 'losses': 125, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'OHNMFMLgZqscHp6lNTGK13pkHvGp32Fo8nn3pC3ASdv28esJ5-3yq-SRgBNJWwmpl7KAU36R1ZWKZQ'} OK
2023-03-09 12:43 Inserted new summoner: crush my heart in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'qmAZrC4XsucMI-3ITdtPZ3WGSz1Uo7iXrNgul2al8GwfvPE', 'summonerName': 'Zac or Dodge', 'leaguePoints': 0, 'rank': 'I', 'wins': 44, 'losses': 29, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'ZdxHDy7Blu8x5e_w_7MMIFkZ6AccjVKmZ0dou4iP1apqkrTWd5AN9ZJqx5P2S_wqcGuOOz4vtLahIw'} OK
2023-03-09 12:43 Inserted new summoner: Zac or Dodge in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'CRFL-0WtvN-4XxBlPWYnsV-EBl4Y5o3DXz7huhow6MOA7w', 'summonerName': 'Bleuris', 'leaguePoints': 1, 'rank': 'I', 'wins': 57, 'losses': 40, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'GXS7A9ZhzC2H0VJJSVbML22diZgFDYoXUyFfJF93NJXGhEP_pI1_O5nP6M9uBQJHDDFiBR_6GKGgUw'} OK
2023-03-09 12:43 Inserted new summoner: Bleuris in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'QkvnXc79Nq5MBLFs1TGgjDh9nZCTsEebJrq6KJYM3maQhQ', 'summonerName': 'BORA BILL DO LOL', 'leaguePoints': 34, 'rank': 'I', 'wins': 38, 'losses': 42, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'nn-QO8mmqdaIOKwZOMYa-czR7lrJy3R6FNiKW9WRcGh0eXaQNk6e9_EUyKUd0eUAa-PKzetlcYD5lg'} OK
2023-03-09 12:43 Inserted new summoner: BORA BILL DO LOL in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'vyhNamjU-ML_sv1Qcy0_4QB2x8KUu7I12vi9jRQ915jc5kedy5O4f5u8Dg', 'summonerName': 'irelia16', 'leaguePoints': 437, 'rank': 'I', 'wins': 165, 'losses': 156, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': '0ulqNL6nnx5q69K0UxfQ88U5bjw1U53ei0fkQ7PXCmhwRmCM-ZJtLSR-_wITZWPPj0vZpS9qSYSvRA'} OK
2023-03-09 12:43 Inserted new summoner: irelia16 in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'vr9lXNhvaWQGdFFxByvaQm0V7J4lj9nX5eW9lsUO6iTkorA', 'summonerName': 'TTheuzinRJ ', 'leaguePoints': 165, 'rank': 'I', 'wins': 103, 'losses': 94, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'rDZkTGgd7ipedluoTNJdznZbZCrXtbVFIiaKorZik8u_Jo32vu-gxmTy4jAQ1xC0uTwdTESSgTV3qw'} OK
2023-03-09 12:43 Inserted new summoner: TTheuzinRJ in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'j61WRHUCRwy5dFhNxjCzoCkUDutsrqs8bk9oNaIPgD1EcQ', 'summonerName': 'buny', 'leaguePoints': 0, 'rank': 'I', 'wins': 88, 'losses': 53, 'veteran': False, 'inactive': False, 'freshBlood': True, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'uGCOYfFbv5hQcB_H_3popxk4s1oPGsOX_xan84gWVR4OYtiK-d4guelsQ8SdL5xhOQgImUgxZO6LoA'} OK
2023-03-09 12:43 Inserted new summoner: buny in region br1, queue RANKED_SOLO_5x5
[DBG] INSERT {'summonerId': 'I8zzB_W4At13xS_owMEiAXzW8YAwVCSFuva7ER9AL57m5EU', 'summonerName': 'af é o colt', 'leaguePoints': 218, 'rank': 'I', 'wins': 58, 'losses': 39, 'veteran': False, 'inactive': False, 'freshBlood': False, 'hotStreak': False, 'tier': 'MASTER', 'request_region': 'br1', 'queue': 'RANKED_SOLO_5x5', 'puuid': 'rU17wioPKn2E3kSCM82ks0PW5hvUlS1ctw1e8WpoHl6MS098gryJi13OGl4its9I_dgnnz2r74vSlg'} OK
2023-03-09 12:43 Inserted new summoner: af é o colt in region br1, queue RANKED_SOLO_5x5
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib64/python3.9/socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f675fe1d670>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='americas.api.riotgames.com', port=443): Max retries exceeded with url: /riot/account/v1/accounts/by-riot-id/AddainhoDoBrazil/BR1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f675fe1d670>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/opc/src/league.py", line 806, in
main()
File "/home/opc/src/league.py", line 801, in main
data_mine(db)
File "/home/opc/src/league.py", line 781, in data_mine
player_list(db)
File "/home/opc/src/league.py", line 438, in player_list
get_top_players(x, y, db)
File "/home/opc/src/league.py", line 327, in get_top_players
x['puuid'] = get_puuid(
File "/home/opc/src/league.py", line 54, in get_puuid
response = requests.get(request_url, headers=headers)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='americas.api.riotgames.com', port=443): Max retries exceeded with url: /riot/account/v1/accounts/by-riot-id/AddainhoDoBrazil/BR1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f675fe1d670>: Failed to establish a new connection: [Errno -2] Name or service not known'))
[opc@lol0 ~]$

Can you help?

Hmmm, it looks like it's the Riot Games API that's failing to resolve the DNS record. What are your network settings on your VCN / firewall / machine? Are you using load balancers or things that may interfere with DNS or change your request's IP address spontaneously?

Closing due to inactivity, make sure to reopen if you still are having issues