Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch testing doesn't kill nodes correctly if process fails to be spawned #54

Closed
dhood opened this issue Jun 16, 2017 · 1 comment · Fixed by #55
Closed

Launch testing doesn't kill nodes correctly if process fails to be spawned #54

dhood opened this issue Jun 16, 2017 · 1 comment · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@dhood
Copy link
Member

dhood commented Jun 16, 2017

If two processes are added to a launch descriptor, and one of them launches fine but the other one causes an error, the first one keeps persisting as a zombie process.

Steps to reproduce:

Use this fork with a test that tries to spawn a talker node and a nonexistent fail node: https://github.com/dhood/launch/blob/zombie_nodes/launch_testing/test/test_zombie_nodes.py

$ ament test --isolated --only-packages launch_testing

The talker will start then the test will crash because of the nonexistent node.

======================================================================
ERROR: test_zombie_nodes.test_zombie_nodes
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dhood/.local/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/dhood/ros2_ws/src/ros2/launch/launch_testing/test/test_zombie_nodes.py", line 22, in test_zombie_nodes
    rc = launcher.launch()
  File "/home/dhood/ros2_ws/install_isolated/launch/lib/python3.5/site-packages/launch/launcher.py", line 96, in launch
    raise e.exception
  File "/home/dhood/ros2_ws/install_isolated/launch/lib/python3.5/site-packages/launch/launcher.py", line 127, in _run
    await self._spawn_process(index)
  File "/home/dhood/ros2_ws/install_isolated/launch/lib/python3.5/site-packages/launch/launcher.py", line 351, in _spawn_process
    **kwargs)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1079, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 184, in _make_subprocess_transport
    **kwargs)
  File "/usr/lib/python3.5/asyncio/base_subprocess.py", line 40, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 649, in _start
    universal_newlines=False, bufsize=bufsize, **kwargs)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'fail'
-------------------- >> begin captured logging << --------------------
asyncio: DEBUG: Using selector: EpollSelector
--------------------- >> end captured logging << ---------------------
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=True debug=False>>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 431, in __del__
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 58, in close
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 139, in remove_signal_handler
  File "/usr/lib/python3.5/signal.py", line 47, in signal
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Exception ignored in: <bound method BaseSubprocessTransport.__del__ of <_UnixSubprocessTransport closed pid=3339 running stdin=<_UnixWritePipeTransport closing fd=15 open> stdout=<_UnixReadPipeTransport fd=16 open>>>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_subprocess.py", line 126, in __del__
  File "/usr/lib/python3.5/asyncio/base_subprocess.py", line 101, in close
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 568, in close
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 560, in write_eof
  File "/usr/lib/python3.5/asyncio/base_events.py", line 497, in call_soon
  File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
  File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
RuntimeError: Event loop is closed

Starting a listener you will notice the talker is still alive:

$ listener
I heard: [Hello World: 508]
I heard: [Hello World: 509]
I heard: [Hello World: 510]
@dhood dhood added the bug Something isn't working label Jun 16, 2017
@dirk-thomas dirk-thomas changed the title Launch testing doesn't kill nodes correctly on error Launch testing doesn't kill nodes correctly if process fails to be spawned Jun 16, 2017
@dirk-thomas dirk-thomas self-assigned this Jun 16, 2017
@dirk-thomas dirk-thomas added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jun 16, 2017
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Jun 16, 2017
@dhood
Copy link
Member Author

dhood commented Jun 16, 2017

with #55 the output becomes:

======================================================================
FAIL: test_zombie_nodes.test_zombie_nodes
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dhood/.local/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/dhood/ros2_ws/src/ros2/launch/launch_testing/test/test_zombie_nodes.py", line 24, in test_zombie_nodes
    assert rc == 0, "The launch file failed with exit code '" + str(rc) + "'. "
AssertionError: The launch file failed with exit code '1'. 
-------------------- >> begin captured logging << --------------------

and no error runtime error is printed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants