Source:
<code>public void launch(Instance machine, Agent agent) throws ServerException, AgentStartException { if (isNullOrEmpty(agent.getScript())) { return; } ListLineConsumer agentLogger = new ListLineConsumer(); LineConsumer lineConsumer = new AbstractLineConsumer() { @Override public void writeLine(String line) throws IOException { machine.getLogger().writeLine(line); agentLogger.writeLine(line); } }; try { final InstanceProcess process = start(machine, agent, lineConsumer); LOG.debug( "Waiting for agent is launched. Workspace ID:{}", agent.getId(), machine.getWorkspaceId()); final long pingStartTimestamp = System.currentTimeMillis(); while (System.currentTimeMillis() - pingStartTimestamp < agentMaxStartTimeMs) { if (agentLaunchingChecker.isLaunched(agent, process, machine)) { return; } else { Thread.sleep(agentPingDelayMs); } } <START> <END> LOG.error( format( "Fail launching agent '%s' in '%s' workspace due to timeout", agent.getName(), machine.getWorkspaceId())); if (this.shouldBlockMachineStart()) { LOG.info("Stopping workspace {}", machine.getWorkspaceId()); process.kill(); } else { LOG.info( "Continuing workspace bootstrap even if agent failed to start.", agent.getName()); return; } } catch (MachineException e) { logAsErrorAgentStartLogs(machine, agent.getName(), agentLogger.getText()); throw new ServerException(e.getServiceError()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ServerException(format("Launching agent %s is interrupted", agent.getName())); } finally { try { lineConsumer.close(); } catch (IOException ignored) { } agentLogger.close(); } logAsErrorAgentStartLogs(machine, agent.getName(), agentLogger.getText()); throw new AgentStartException( format( "Fail launching agent %s. Workspace ID:%s", agent.getName(), machine.getWorkspaceId())); }</code><technical_language>delete this line of this PR</technical_language>

Target:
public void launch(Instance machine, Agent agent) throws ServerException, AgentStartException { if (isNullOrEmpty(agent.getScript())) { return; } ListLineConsumer agentLogger = new ListLineConsumer(); LineConsumer lineConsumer = new AbstractLineConsumer() { @Override public void writeLine(String line) throws IOException { machine.getLogger().writeLine(line); agentLogger.writeLine(line); } }; try { final InstanceProcess process = start(machine, agent, lineConsumer); LOG.debug( "Waiting for agent is launched. Workspace ID:{}", agent.getId(), machine.getWorkspaceId()); final long pingStartTimestamp = System.currentTimeMillis(); while (System.currentTimeMillis() - pingStartTimestamp < agentMaxStartTimeMs) { if (agentLaunchingChecker.isLaunched(agent, process, machine)) { return; } else { Thread.sleep(agentPingDelayMs); } } LOG.error( format( "Fail launching agent '%s' in '%s' workspace due to timeout", agent.getName(), machine.getWorkspaceId())); if (this.shouldBlockMachineStartOnError()) { LOG.info("Stopping workspace {}", machine.getWorkspaceId()); process.kill(); } else { LOG.info( "Continuing workspace bootstrap even if agent failed to start.", agent.getName()); return; } } catch (MachineException e) { logAsErrorAgentStartLogs(machine, agent.getName(), agentLogger.getText()); throw new ServerException(e.getServiceError()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ServerException(format("Launching agent %s is interrupted", agent.getName())); } finally { try { lineConsumer.close(); } catch (IOException ignored) { } agentLogger.close(); } logAsErrorAgentStartLogs(machine, agent.getName(), agentLogger.getText()); throw new AgentStartException( format( "Fail launching agent %s. Workspace ID:%s", agent.getName(), machine.getWorkspaceId())); }