Repository navigation
Closed
Labels
bugSomething isn't working
Description
I'm assuming this is related to something new in Python 3.6, since some asyncio stuff changed in that version. This is the new test failure after updating the macOS CI machines:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/Users/osrf/jenkins/workspace/ci_osx/ws/src/ros2/launch/launch/launch/launcher.py", line 411, in run
self.launcher.launch()
File "/Users/osrf/jenkins/workspace/ci_osx/ws/src/ros2/launch/launch/launch/launcher.py", line 96, in launch
raise e.exception
File "/Users/osrf/jenkins/workspace/ci_osx/ws/src/ros2/launch/launch/launch/launcher.py", line 127, in _run
await self._spawn_process(index)
File "/Users/osrf/jenkins/workspace/ci_osx/ws/src/ros2/launch/launch/launch/launcher.py", line 351, in _spawn_process
**kwargs)
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 1190, in subprocess_exec
bufsize, **kwargs)
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 194, in _make_subprocess_transport
self._child_watcher_callback, transp)
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 858, in add_child_handler
"Cannot add child handler, "
RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
I looked into the problem for a while, but I'm not sure why this error is happening. I think the loop (main thread loop) should be attached to the child watcher, but maybe I'm missing something.
@dirk-thomas do you have any idea about this issue?
Activity
wjwwood commentedon Feb 18, 2017
@dirk-thomas can you clarify what this comment is talking about:
launch/launch/launch/launcher.py
Line 105 in 3b990bc
It seems like asyncio is upset that the child watcher (in this case
None) doesn't have a loop attached. Do you remember why exactly we're doing this?dirk-thomas commentedon Feb 18, 2017
When you want to launch a launch file twice (basically after it finished launch it again) it fails without this line.
wjwwood commentedon Feb 18, 2017
Hmm, either way, removing this line doesn't fix this issue. Do you know of any other places in the code where we are setting up or changing a child watcher? I'm not finding anything else by searching.
dhood commentedon Feb 18, 2017
FWIW I saw that someone else ran into this issue and fixed it with https://github.com/neovim/python-client/pull/241/files (not sure how that would work if we need it to be
None)wjwwood commentedon Feb 18, 2017
I'll try to adapt that change, thanks @dhood.
wjwwood commentedon Feb 22, 2017
I can get all of the tests to run individually, but I cannot get past the tests running together through ctest.
I am using this patch:
But I always get this error when running the tests via ctest:
Which, looking at the code, makes no sense to me:
launch/launch/launch/launcher.py
Line 87 in 3b990bc
As the very previous line does
self.loop = asyncio.new_event_loop().So, I guess we could either:
.launch()from a thread, i.e. get rid ofAsyncLauncherI'm leaning towards the last option. Base on this SO:
http://stackoverflow.com/a/28917653/671658
It looks like you ought not use subprocess async calls from outside the main thread unless you also have a running loop in the main thread, which is probably exactly not what is happening when you use asynclauncher.
Looking on input for how to move forward on this one.
wjwwood commentedon Mar 16, 2017
So, we discussed this off-line (some days ago now) and I think the conclusion was just to not support
AsyncLauncher, i.e. not support running launch in a non-main thread. This appears to work with some hackery in Python 3.5, but Python 3.6 reintroduces issues. This SO summarizes it:Since Python 3.6 is supposedly the first "stable" release of asyncio, I'm inclined to go along with it and say that launch only works if you meet the above criteria as well, even with Python 3.5. This means the original purpose of
AsyncLauncherdoesn't really work anymore. My understanding of the idea behind it was that you'd launch in a separate thread and do other things in the main python thread. This would only work if those "other things" was running an asyncio loop.I propose we just remove
AsyncLauncherand the related tests until someone asks specifically for this feature. @ros2/team can you guys please +1/-1 this proposal? Thanks.dirk-thomas commentedon Mar 17, 2017
Since we don't use it at the moment +1 to remove this.
wjwwood commentedon Mar 20, 2017
Ok, I haven't gotten any feedback on this, so I'm going to proceed with a pr to remove this feature/test.
clalancette commentedon Mar 20, 2017
Yeah, I'm with Dirk, if we aren't using it, let's just remove it, and we'll figure out another solution in the future if we need something similar.
wjwwood commentedon Mar 20, 2017
@dirk-thomas sorry, you comment didn't show up (email or on the webpage) until I posted my comment 😢. Some strange notification issues going on I think...
mikaelarguedas commentedon Mar 20, 2017
👍 for removing it for now and see if a critical use case shows up requiring us to implement an alternative
remove async launcher to fix #51
remove async launcher to fix #51 (#52)