bugwarrior
bugwarrior copied to clipboard
github: on connect fail, closes tasks
v1.8.0 or maybe da98f3ee88a8c84716985cb2bb834ede74eac09e
When offline or barely online, a connection error is causing tasks to get closed:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/__init__.py", line 503, in _aggregate_issues
for issue in service.issues():
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 439, in issues
issues.update(self.get_query(self.query))
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 333, in get_query
for issue in self.client.get_query(query):
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 45, in get_query
return self._getter(url, subkey='items')
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 86, in _getter
response = self.session.get(link['next'], **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /search/issues?q=is:open%20is:issue%20assignee:≈≈≈%20user:≈≈≈&per_page=100 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10d7b4040>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
Worker for [github_srl295] failed: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user/issues?per_page=100 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x110c8fb80>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or 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-1.26.6-py3.9.egg/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x110c8fb80>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or 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-2.26.0-py3.9.egg/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3-1.26.6-py3.9.egg/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user/issues?per_page=100 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x110c8fb80>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/__init__.py", line 503, in _aggregate_issues
for issue in service.issues():
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 459, in issues
self.get_directly_assigned_issues().items())
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 345, in get_directly_assigned_issues
for issue in self.client.get_directly_assigned_issues():
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 61, in get_directly_assigned_issues
return self._getter(url)
File "/usr/local/lib/python3.9/site-packages/bugwarrior-1.8.0-py3.9.egg/bugwarrior/services/github.py", line 86, in _getter
response = self.session.get(link['next'], **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests-2.26.0-py3.9.egg/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user/issues?per_page=100 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x110c8fb80>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
ERROR:bugwarrior.services:Aborted ≈jira≈ due to critical error.
NoneType: None
ERROR:bugwarrior.services:Aborted github_≈ due to critical error.
NoneType: None
INFO:bugwarrior.services:Done aggregating remote issues.
INFO:bugwarrior.db:Adding 0 tasks
INFO:bugwarrior.db:Updating 0 tasks
INFO:bugwarrior.db:Closing 86 tasks
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
INFO:bugwarrior.db:Completing task ≈≈≈≈≈≈ …
The JIRA tasks did not get the same treatment.
Rerunning bugwarrior-pull with a good connection caused the tasks to reopen, of course.
still happens on latest bugwarrior aa660b258f95e29b07508f555ddc639e9cbdab82
I think the problem here is that the service = github
run was aborted due to a critical error, BUT all remaining open tasks were closed anyway.
To repro:
- go offline
-
bugwarrior-pull --dry-run
The stack doesn't reflect the function below but it might be a similar issue. If there's an exception, issues won't accumulate.
https://github.com/ralphbean/bugwarrior/blob/develop/bugwarrior/services/github.py#L333-L344
def get_query(self, query):
…
issues = {}
for issue in self.client.get_query(query):
…
try:
…
except ValueError as e:
log.critical(e) # error printed here
else:
issues[url] = (repo, issue) # not reached
return issues # issues = {} still!
The stack doesn't reflect the function below but it might be a similar issue. If there's an exception, issues won't accumulate.
https://github.com/ralphbean/bugwarrior/blob/develop/bugwarrior/services/github.py#L333-L344
def get_query(self, query): … issues = {} for issue in self.client.get_query(query): … try: … except ValueError as e: log.critical(e) # error printed here else: issues[url] = (repo, issue) # not reached return issues # issues = {} still!
This is an appealing explanation, but the problem is it isn't clear how these ConnectionError
's (which inherit from OSError
) could lead to a ValueError
given the exception hierarchy.
edit: Per #897 I now realize that requests.exceptions.ConnectionError != ConnectionError
. That said, the logic stands because requests.exceptions.ConnectionError
ultimately still inherits from OSError
.