Skip to content

Commit

Permalink
Merge pull request #672 from simskij/revert-python-libjuju
Browse files Browse the repository at this point in the history
Revert "Avoid ignoring asyncio exceptions in coroutines"

This reverts commit f7552be. The suggested fix did not really solve the issue it was supposed to solve as it instead fails with [Errno 9] Bad File Descriptor crashing most of our tests.
  • Loading branch information
jameinel authored Apr 25, 2022
2 parents ac9fe69 + 5af9477 commit 8c938c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ async def _debug_logger(self):
# be cancelled by the reconnect and we don't want the reconnect
# to be aborted half-way through
jasyncio.ensure_future(self.reconnect())
raise
return
except Exception as e:
log.exception("Error in debug logger : %s" % e)
jasyncio.create_task(self.close())
Expand All @@ -539,7 +539,7 @@ async def _receiver(self):
# be cancelled by the reconnect and we don't want the reconnect
# to be aborted half-way through
jasyncio.ensure_future(self.reconnect())
raise
return
except Exception as e:
log.exception("Error in receiver")
# make pending listeners aware of the error
Expand Down Expand Up @@ -576,7 +576,7 @@ async def _do_ping():
# The connection has closed - we can't do anything
# more until the connection is restarted.
log.debug('ping failed because of closed connection')
raise
pass

async def rpc(self, msg, encoder=None):
'''Make an RPC to the API. The message is encoded as JSON
Expand Down
5 changes: 2 additions & 3 deletions juju/jasyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger):
try:
task.result()
except CancelledError:
raise
pass
except websockets.exceptions.ConnectionClosed:
raise
return
except Exception as e:
# This really is an arbitrary exception we need to catch
#
Expand All @@ -76,7 +76,6 @@ def _task_result_exp_handler(task, task_name=task_name, logger=logger):
# event_handler, which won't do anything but yell 'Task
# exception was never retrieved' anyways.
logger.exception("Task %s raised an exception: %s" % (task_name, e))
raise

task = create_task(coro)
task.add_done_callback(functools.partial(_task_result_exp_handler, task_name=task_name, logger=logger))
Expand Down

0 comments on commit 8c938c9

Please sign in to comment.