microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.42k stars 2.58k forks source link

[Question]: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/bin/bash' #18476

Open zlee520 opened 1 year ago

zlee520 commented 1 year ago

Task name

https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line

Task version

2.201.1

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure DevOps Server 2022

Operation system

Ubuntu 20.04

Question

can not run java webapp

pipelines YAML: ----------------------------------------------------

steps:
- script: |
   cd /home/ubuntu/project/stock
   nohup java -jar home-admin-0.0.1-SNAPSHOT.jar &

  displayName: start
  continueOnError: true
  timeoutInMinutes: 50

----------------------------------------------------------------------------

2023-06-10T13:12:26.2504639Z ##[section]正在启动: start
2023-06-10T13:12:26.2522099Z ==============================================================================
2023-06-10T13:12:26.2523162Z Task         : 命令行
2023-06-10T13:12:26.2523583Z Description  : 在 Linux 和 macOS 上使用 Bash、在 Windows 上使用 cmd.exe 运行命令行脚本
2023-06-10T13:12:26.2524385Z Version      : 2.201.1
2023-06-10T13:12:26.2524850Z Author       : Microsoft Corporation
2023-06-10T13:12:26.2525420Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2023-06-10T13:12:26.2527084Z ==============================================================================
2023-06-10T13:12:26.7230417Z 正在生成脚本。
2023-06-10T13:12:26.7268014Z ========================== Starting Command Output ===========================
2023-06-10T13:12:26.7346994Z [command]/usr/bin/bash --noprofile --norc /home/ubuntu/azagent/_work/_temp/36772aca-8ad3-4fd4-82dd-a308f56afe44.sh
2023-06-10T13:12:31.7576219Z 
2023-06-10T13:12:31.7597526Z   .   ____          _            __ _ _
2023-06-10T13:12:31.7603012Z  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
2023-06-10T13:12:31.7606636Z ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2023-06-10T13:12:31.7610016Z  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
2023-06-10T13:12:31.7612974Z   '  |____| .__|_| |_|_| |_\__, | / / / /
2023-06-10T13:12:31.7616550Z  =========|_|==============|___/=/_/_/_/
2023-06-10T13:12:31.7700929Z  :: Spring Boot ::               (v2.7.12)
2023-06-10T13:12:31.7728655Z 
2023-06-10T13:12:36.7592276Z The STDIO streams did not close within 10 seconds of the exit event from process '/usr/bin/bash'. This may indicate a child process inherited the STDIO streams and has not yet exited.
2023-06-10T13:12:41.7795837Z ##[section]即将完成: start
KonstantinTyukalov commented 1 year ago

Hi @zlee520, this message means that the bash child process is not finished.

As I see it, you are trying to run your application in the background, so in this case the pipeline task will not wait for the background process to finish. But this should not be the reason for the task to fail.

What problem are you seeing in this case? And could you explain what you are trying to do and what result do you expect?

zlee520 commented 1 year ago

Hi @zlee520, this message means that the bash child process is not finished.

As I see it, you are trying to run your application in the background, so in this case the pipeline task will not wait for the background process to finish. But this should not be the reason for the task to fail.

What problem are you seeing in this case? And could you explain what you are trying to do and what result do you expect?

hello, I want to start a java app, this task is successfull but the java app not started running the same command directly on the server can start the app

sushilInfy commented 11 months ago

Hi , Do we have any resolution for it ? We are also facing the same thing.

ArwynFr commented 7 months ago

@KonstantinTyukalov I have a similar problem than OP but with pwsh task, behaves similarly to bash:

steps:
- pwsh: docker build .

In my exemple I'm trying to build a docker image, which takes around 3 minutes. The problem I'm facing is that the error provokes a failure of the step, even though the build continues and succeeds. I don't want to use continueOnError: true because then I wouldn't fail the step when the docker image fails to build.

As I see it, you are trying to run your application in the background, so in this case the pipeline task will not wait for the background process to finish. But this should not be the reason for the task to fail.

The step actually runs to completion AND fails because of that error.

I don't understand why this is a topic in the first place. Pipelines are expected to run long running processes that use STDIO to provide some output. This shouldn't even yield a warning, the task should simply wait for the process to complete.

ArwynFr commented 7 months ago

Please note, this works fine for me on Windows agents, it only fails on Linux agents.

$ uname -a
Linux hostname 3.10.0-1160.83.1.el7.x86_64 #1 SMP Wed Jan 25 16:41:43 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
mahomedalid commented 3 weeks ago

Probably related to https://github.com/microsoft/azure-pipelines-tasks/issues/19844