-
Notifications
You must be signed in to change notification settings - Fork 145
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
New test failure with Python 3.6 #51
Comments
@dirk-thomas can you clarify what this comment is talking about: launch/launch/launch/launcher.py Line 105 in 3b990bc
if os.name != 'nt':
# the watcher must be reset otherwise a repeated invocation fails inside asyncio
asyncio.get_event_loop_policy().set_child_watcher(None) It seems like asyncio is upset that the child watcher (in this case |
When you want to launch a launch file twice (basically after it finished launch it again) it fails without this line. |
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. |
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 |
I'll try to adapt that change, thanks @dhood. |
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: diff --git a/launch/launch/launcher.py b/launch/launch/launcher.py
index 757affe..a627c55 100644
--- a/launch/launch/launcher.py
+++ b/launch/launch/launcher.py
@@ -101,7 +101,7 @@ class DefaultLauncher(object):
loop.close()
with self.loop_lock:
self.loop = None
- if os.name != 'nt':
+ if os.name != 'nt' and isinstance(threading.current_thread(), threading._MainThread):
# the watcher must be reset otherwise a repeated invocation fails inside asyncio
asyncio.get_event_loop_policy().set_child_watcher(None)
@@ -398,6 +398,11 @@ class AsynchronousLauncher(threading.Thread):
def __init__(self, launcher):
super(AsynchronousLauncher, self).__init__()
self.launcher = launcher
+ loop = asyncio.get_event_loop()
+ if loop.is_closed():
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ asyncio.get_child_watcher().attach_loop(loop)
def terminate(self):
self.launcher.interrupt_launch()
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 So, I guess we could either:
I'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. |
So, we discussed this off-line (some days ago now) and I think the conclusion was just to not support
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 I propose we just remove |
Since we don't use it at the moment +1 to remove this. |
Ok, I haven't gotten any feedback on this, so I'm going to proceed with a pr to remove this feature/test. |
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. |
@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... |
👍 for removing it for now and see if a critical use case shows up requiring us to implement an alternative |
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:
http://ci.ros2.org/job/ci_osx/1720/testReport/junit/(root)/test_interrupt_asynchronous_launcher/test_interrupt_asynchronous_launcher/
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?
The text was updated successfully, but these errors were encountered: