Add post-mortem catch around failed transport addr binds to aid with runtime debugging
parent
e94f1261b5
commit
4314a59327
|
@ -260,10 +260,14 @@ async def open_root_actor(
|
||||||
# start the actor runtime in a new task
|
# start the actor runtime in a new task
|
||||||
async with trio.open_nursery() as nursery:
|
async with trio.open_nursery() as nursery:
|
||||||
|
|
||||||
# ``_runtime.async_main()`` creates an internal nursery and
|
# ``_runtime.async_main()`` creates an internal nursery
|
||||||
# thus blocks here until the entire underlying actor tree has
|
# and blocks here until any underlying actor(-process)
|
||||||
# terminated thereby conducting structured concurrency.
|
# tree has terminated thereby conducting so called
|
||||||
|
# "end-to-end" structured concurrency throughout an
|
||||||
|
# entire hierarchical python sub-process set; all
|
||||||
|
# "actor runtime" primitives are SC-compat and thus all
|
||||||
|
# transitively spawned actors/processes must be as
|
||||||
|
# well.
|
||||||
await nursery.start(
|
await nursery.start(
|
||||||
partial(
|
partial(
|
||||||
async_main,
|
async_main,
|
||||||
|
|
|
@ -1405,6 +1405,7 @@ async def async_main(
|
||||||
# - root actor: the ``accept_addr`` passed to this method
|
# - root actor: the ``accept_addr`` passed to this method
|
||||||
assert accept_addrs
|
assert accept_addrs
|
||||||
|
|
||||||
|
try:
|
||||||
actor._server_n = await service_nursery.start(
|
actor._server_n = await service_nursery.start(
|
||||||
partial(
|
partial(
|
||||||
actor._serve_forever,
|
actor._serve_forever,
|
||||||
|
@ -1412,6 +1413,14 @@ async def async_main(
|
||||||
listen_sockaddrs=accept_addrs,
|
listen_sockaddrs=accept_addrs,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
except OSError as oserr:
|
||||||
|
# NOTE: always allow runtime hackers to debug
|
||||||
|
# tranport address bind errors - normally it's
|
||||||
|
# something silly like the wrong socket-address
|
||||||
|
# passed via a config or CLI Bo
|
||||||
|
entered_debug = await _debug._maybe_enter_pm(oserr)
|
||||||
|
raise
|
||||||
|
|
||||||
accept_addrs: list[tuple[str, int]] = actor.accept_addrs
|
accept_addrs: list[tuple[str, int]] = actor.accept_addrs
|
||||||
|
|
||||||
# NOTE: only set the loopback addr for the
|
# NOTE: only set the loopback addr for the
|
||||||
|
|
Loading…
Reference in New Issue