From: Adrian Freihofer <[email protected]> The generated preLaunchTask SSH command waits for the debug server to listen on its port by polling /proc/net/tcp(6), and gave up after 100 retries with a 0.1s sleep each, reporting only "<server> did not start on port <port>".
test_devtool_ide_sdk_code_cmake_clang hit this intermittently on the autobuilder. The message does not say whether the server was still starting or had already failed, so the cause could not be determined from the logs. Dump the debug server log to stderr when giving up, so the reason ends up in the SSH command output which both the IDE and oe-selftest already surface, and include the number of retries reached. Raise the retry count from 100 to 300. The loop sleeps 0.1s per retry, and the wall-clock time is dominated by that sleep: it barely grows under CPU load (100 retries took 10.5s idle and 12.0s with the host CPUs oversubscribed 4x), so the previous limit really was a ~10s budget for the debug server to come up. The helper is used by the lldb-server path only, so the gdbserver commands are unchanged. Signed-off-by: Adrian Freihofer <[email protected]> --- scripts/lib/devtool/ide_plugins/__init__.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/lib/devtool/ide_plugins/__init__.py b/scripts/lib/devtool/ide_plugins/__init__.py index deb6050907..63e9682e73 100644 --- a/scripts/lib/devtool/ide_plugins/__init__.py +++ b/scripts/lib/devtool/ide_plugins/__init__.py @@ -97,19 +97,28 @@ class DebuggerCrossConfig: modes.append(DebuggerServerModes.ATTACH) return modes + # Re-tries in 0.1s Example: 300 * 0.1s, i.e. ~30s. + TARGET_START_RETRIES = 300 + def _target_tcp_port_check_cmd(self): hex_port = "%04X" % self.debug_server_port return "grep -q :%s /proc/net/tcp /proc/net/tcp6 2>/dev/null" % hex_port - def _target_wait_for_tcp_port_cmd(self, pid_var=None): + def _target_wait_for_tcp_port_cmd(self, pid_var=None, log_file=None): + """Shell fragment waiting until the debug server listens on its port. + + The server log is dumped to stderr when giving up. + """ + dump_log = "cat %s >&2; " % log_file if log_file else "" cleanup = "" if pid_var: cleanup = "kill \\$_%s 2>/dev/null; " % pid_var return ( - "_w=0; while ! %s; do _w=\\$((_w+1)); [ \\$_w -lt 100 ] || { " - "%secho %s did not start on port %s >&2; exit 1; }; sleep 0.1; done;" - % (self._target_tcp_port_check_cmd(), cleanup, self.DEBUG_SERVER_NAME, - self.debug_server_port)) + "_w=0; while ! %s; do _w=\\$((_w+1)); [ \\$_w -lt %d ] || { " + "%secho %s did not start on port %s after \\$_w retries >&2; %sexit 1; }; " + "sleep 0.1; done;" + % (self._target_tcp_port_check_cmd(), self.TARGET_START_RETRIES, + cleanup, self.DEBUG_SERVER_NAME, self.debug_server_port, dump_log)) def initialize(self): """Called after construction to generate any required config files.""" @@ -249,7 +258,7 @@ class LldbServerConfig(DebuggerCrossConfig): lldb_server, self.debug_server_port, log_file) cmd += "echo \\$_lldb_server_pid > %s; " % pid_file cmd += self._target_wait_for_tcp_port_cmd( - "lldb_server_pid") + "lldb_server_pid", log_file) else: raise DevtoolError( "lldb-server does not support mode %s " -- 2.55.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#243153): https://lists.openembedded.org/g/openembedded-core/message/243153 Mute This Topic: https://lists.openembedded.org/mt/120698346/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
