lyft / lyft/python-blessclient

Cannot refresh public IP randomly

Open
#30 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
117
Forks
31
PR merge metrics
No merged PRs in 30d

Description

On occasion, on the first cold run:

DEBUG:root:Cache get disabled                                                                                       
DEBUG:root:Cache get disabled                                                                                                    
DEBUG:root:Getting current public IP                                                                                                                                                                                                          DEBUG:root:Could not refresh public IP from http://api.ipify.org                                                                                                                                                                              Traceback (most recent call last):                                                                                                                                                                                                              File "/home/marc/.blessclient/blessclient/user_ip.py", line 53, in _fetchIP                                                                                                                                                    
    with contextlib.closing(urlopen(url, timeout=2)) as f:                                                                                                                                                                                      File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 154, in urlopen                                                                                                                                                         return opener.open(url, data, timeout)                                                                                                                                                                                                      File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 429, in open                                                                                                                                                            response = self._open(req, data)                                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 447, in _open                                                                                                                                        
    '_open', req)                                                                                                                                                                                                                               File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 407, in _call_chain                                                                                                                                                     result = func(*args)                                                                                                                                                     
  File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 1228, in http_open                                                                                                                                                      return self.do_open(httplib.HTTPConnection, req)                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 1201, in do_open                                                                                                                                                        r = h.getresponse(buffering=True)                                                                                                                                                                                                           File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 1136, in getresponse                                                                                                                                                    response.begin()                                                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 453, in begin                                                                                                                                                           version, status, reason = self._read_status()                                                                                                                                                                                               File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 409, in _read_status                                           
    line = self.fp.readline(_MAXLINE + 1)                                                                                                                                  
  File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/socket.py", line 480, in readline                                                                                                                                                         data = self._sock.recv(self._rbufsize)                                                                                                                                                                                                    timeout: timed out                                                                                                               
DEBUG:root:Could not refresh public IP from http://canihazip.com
Traceback (most recent call last):                                                                                  
  File "/home/marc/.blessclient/blessclient/user_ip.py", line 53, in _fetchIP                                                    
    with contextlib.closing(urlopen(url, timeout=2)) as f:                                                                                                                                                                                      File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 154, in urlopen                                                                                                                                                         return opener.open(url, data, timeout)                                                                                                                                                                                                      File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 429, in open                                                                                                                                           
    response = self._open(req, data)                                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 447, in _open                                                                                                                                                           '_open', req)                                                                                                                                                                                                                               File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 407, in _call_chain                                                                                                                                                     result = func(*args)                                                                                                                                                                                                                        File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 1228, in http_open                                                                                                                                   
    return self.do_open(httplib.HTTPConnection, req)                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/urllib2.py", line 1201, in do_open                                                                                                                                                        r = h.getresponse(buffering=True)                                                                                                                                        
  File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 1136, in getresponse                                                                                                                                                    response.begin()                                                                                                                                                                                                                            File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 453, in begin                                                                                                                                                           version, status, reason = self._read_status()                                                                                                                                                                                               File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 409, in _read_status                                                                                                                                                    line = self.fp.readline(_MAXLINE + 1)                                                                                                                                                                                                     
  File "/home/marc/.pyenv/versions/2.7.12/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out
Traceback (most recent call last):
  File "/home/marc/.blessclient/blessclient.run", line 11, in <module>
    load_entry_point('blessclient', 'console_scripts', 'blessclient')()
  File "/home/marc/.blessclient/blessclient/client.py", line 643, in main
    bless(region, args.nocache, args.gui, args.host, bless_config)
  File "/home/marc/.blessclient/blessclient/client.py", line 547, in bless
    my_ip = userIP.getIP()
  File "/home/marc/.blessclient/blessclient/user_ip.py", line 29, in getIP
    self._refreshIP()
  File "/home/marc/.blessclient/blessclient/user_ip.py", line 43, in _refreshIP
    raise Exception('Could not refresh public IP')
Exception: Could not refresh public IP

Immediately re-running this works.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with blessclient/user_ip.py, especially getIP, _refreshIP, and _fetchIP, then trace the call from blessclient/client.py. Reproduce the cold-run timeout using the two listed public-IP endpoints and verify that a first run completes without raising "Could not refresh public IP".

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.