robotics-in-concert / rocon_tools

Rocon tools and modules usable outside of multimaster systems.
7 stars 18 forks source link

Subprocess popen error #53

Closed jihoonl closed 7 years ago

jihoonl commented 10 years ago
^CTraceback (most recent call last):
  File "/home/jihoonl/research/ros/rocon/devel/bin/rocon_launch", line 5, in <module>
    exec(fh.read())
  File "<string>", line 18, in <module>
  File "/home/jihoonl/research/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 152, in main
    signal.pause()
  File "/home/jihoonl/research/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 114, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 73, in shutdown_roslaunch_windows
    roslaunch_pids.extend(utils.get_roslaunch_pids(process.pid))
  File "/home/jihoonl/research/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/utils.py", line 98, in get_roslaunch_pids
    ps_command = subprocess.Popen("ps -o pid -o comm --ppid %d --noheaders" % parent_pid, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
TypeError: %d format: a number is required, not NoneType
stonier commented 10 years ago

@jihoonl are you able to consistently reproduce this error?

jihoonl commented 10 years ago

No. I have seen this once so far.

stonier commented 10 years ago

Did it happen when ctrl-c'ing the windows as they were starting up? There is a small window there where the pid value can be None.

jihoonl commented 10 years ago

I will update the issue when I see this again.

stonier commented 10 years ago

I bypassed it in the commit above and added a warning log so we can see if it happens incorrectly in future. I believe it can only happen when killing the windows while they are still trying to spawn, which is not a bug. If the user decides to shutdown so early, then he can clean it up. Adding infrastructure to wait around to check and cleanup is too much overhead right now.

stonier commented 10 years ago

Reopen this if you see that log warning outside the startup-immediate shutdown sequence.

stonier commented 10 years ago

Saw again, slightly different message this time...no NoneType.

^Caborting call to find child roslaunches of a non-existant parent pid (can happen if cancelling spawned processes while they are still establishing).
Terminating roslaunch [pid: 20305]
Terminating roslaunch [pid: 20292]
Terminating roslaunch [pid: 20280]
Traceback (most recent call last):
  File "/mnt/zaphod/ros/rocon/devel/bin/rocon_launch", line 5, in <module>
    exec(fh.read())
  File "<string>", line 18, in <module>
  File "/mnt/zaphod/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 153, in main
    signal.pause()
  File "/mnt/zaphod/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/mnt/zaphod/ros/rocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 93, in shutdown_roslaunch_windows
    os.killpg(process.pid, signal.SIGTERM)
TypeError: an integer is required
jihoonl commented 10 years ago
yujin@isaac:~/demos/rocon_demo_201405/src/cafe_concert/cafe_concert/services/cafe_database$ rocon_launch cafe_concert cafe_sim.concert --screen
Launching /home/yujin/demos/rocon_demo_201405/src/cafe_concert/cafe_concert/solution/concert.launch on port 11311
Launching /home/yujin/demos/rocon_demo_201405/src/cafe_concert/cafe_concert/launch/cafe_backend.launch on port 11312
Launching /home/yujin/demos/rocon_demo_201405/src/cafe_concert/cafe_concert/launch/cafe_backend.launch on port 11313
Launching /home/yujin/demos/rocon_demo_201405/src/cafe_concert/cafe_concert/launch/cafe_backend.launch on port 11314
^Caborting call to find child roslaunches of a non-existant parent pid (can happen if cancelling spawned processes while they are still establishing).
Terminating roslaunch [pid: 2655]
Terminating roslaunch [pid: 2648]
Terminating roslaunch [pid: 2657]
Invalid pid value [None][an integer is required]
stonier commented 10 years ago

Really stumped on this one. The above was reproduced with a two minute gap between starting and stopping. Could easily check this and ignore the problem, but doesn't help understand why the problem is there.

jihoonl commented 10 years ago

Is this related?

(gnome-terminal:32221): GLib-GIO-CRITICAL **: g_settings_get: the format string may not contain '&' (key 'monospace-font-name' from schema 'org.gnome.desktop.interface'). This call will probably stop working with a future version of glib.
Kill signal failed to reach the terminal - typically this means the terminal has already shut down.
Traceback (most recent call last):
  File "/home/jihoonl/research/ros/gazeborocon/devel/bin/rocon_launch", line 5, in <module>
    exec(fh.read())
  File "<string>", line 18, in <module>
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 153, in main
    signal.pause()
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 82, in shutdown_roslaunch_windows
    rocon_python_utils.system.wait_pid(pid)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_python_utils/src/rocon_python_utils/system/pid.py", line 99, in wait_pid
    delay = check_timeout(delay)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_python_utils/src/rocon_python_utils/system/pid.py", line 73, in check_timeout
    time.sleep(delay)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 95, in shutdown_roslaunch_windows
    console.warning("Kill signal failed to reach the terminal - typically this means the terminal has already shut down.")
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_console/src/rocon_console/console.py", line 113, in warning
    print(yellow + msg + reset)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 95, in shutdown_roslaunch_windows
    console.warning("Kill signal failed to reach the terminal - typically this means the terminal has already shut down.")
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_console/src/rocon_console/console.py", line 113, in warning
    print(yellow + msg + reset)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 95, in shutdown_roslaunch_windows
    console.warning("Kill signal failed to reach the terminal - typically this means the terminal has already shut down.")
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_console/src/rocon_console/console.py", line 113, in warning
    print(yellow + msg + reset)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 115, in signal_handler
    self.terminal.shutdown_roslaunch_windows(self.processes, self.hold)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/terminals.py", line 95, in shutdown_roslaunch_windows
    console.warning("Kill signal failed to reach the terminal - typically this means the terminal has already shut down.")
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_console/src/rocon_console/console.py", line 113, in warning
    print(yellow + msg + reset)
  File "/home/jihoonl/research/ros/gazeborocon/src/rocon_tools/rocon_launch/src/rocon_launch/launch.py", line 121, in signal_handler
    os.unlink(f.name)
OSError: [Errno 2] No such file or directory: '/tmp/tmpqRyttt'
stonier commented 10 years ago

I doubt it, but can't qualify that 100%. Probably something 'cleaned it' from the tmp directory before we got to it.

stonier commented 7 years ago

Long time since seen...closing. Reopen if new reports come in.