Bamboo Remote Agent using Linux Systemd service fails to start.
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
The bamboo remote agent, which uses the Systemd service, fails to start successfully. An error message appears in the agent logs stating, "STATUS | wrapper | YYYY/MM/DD HH:MM:SS | <-- Wrapper Stopped". This indicates that the wrapper has stopped.
環境
The solution has been tested in the following environments:
Bamboo Data Center versions 9.6.0 and 9.5.1
Red Hat Linux 8.8 and Oracle Enterprise Linux 8.9
診断
The following error message appears in <Bamboo-agent-home>/atlassian-bamboo-agent.log when starting the Bamboo remote agent systemd service:
STATUS | wrapper | YYYY/MM/DD HH:MM:SS | <-- Wrapper Stopped"
After following the steps in "Option 2: Debug only the Remote Agent" to enable Debug Logging, additional log messages can be observed in the atlassian-bamboo-agent.log file.
INFO | jvm 1 | 2024/03/28 15:09:05 | 2024-03-28 15:09:05,322 INFO [AgentRunnerThread] [RemoteAgent] Starting application context...
DEBUG | wrapper | 2024/03/28 15:09:06 | Signal trapped. Details:
DEBUG | wrapper | 2024/03/28 15:09:06 | signal number=15 (SIGTERM), source="kill, sigsend or raise"
DEBUG | wrapper | 2024/03/28 15:09:06 | signal generated by PID: 18802 (Session PID: 18802), UID: 1000 (beejay)
STATUS | wrapper | 2024/03/28 15:09:06 | TERM trapped. Shutting down.
DEBUG | wrapper | 2024/03/28 15:09:06 | wrapperStopProcess(0, TRUE) called.
DEBUG | wrapper | 2024/03/28 15:09:06 | Sending stop signal to JVM
DEBUG | wrapperp | 2024/03/28 15:09:06 | Send a packet STOP : NULL
.....
DEBUG | wrapper | 2024/03/28 15:09:07 | JVM process exited with a code of 0, leaving the Wrapper exit code set to 0.
DEBUG | wrapper | 2024/03/28 15:09:07 | JVM exited normally.
DEBUG | wrapper | 2024/03/28 15:09:07 | Exit code: 0
STATUS | wrapper | 2024/03/28 15:09:07 | <-- Wrapper Stopped
原因
The systemd configuration for the remote agent's service was using a 'simple' service type, as shown in the snippet below. This was also tested with other service types including 'exec', 'notify', and 'notify-reload'.
#cat /etc/systemd/system/bamboo-agent.service
[Unit]
Description=Bamboo Agent
After=syslog.target network.target
[Service]
Type=simple
The service type configures the mechanism through which the service notifies the manager when the service startup is complete. It is recommended to set this service type to 'forking' for a Bamboo remote agent service. This configuration allows the manager to consider the service as started immediately after the binary, which was forked off by the manager exits.
ソリューション
There are two possible solutions to this issue.
ソリューション 1
First, delete the systemd service. Next on the remote agent host, use the following command to create a new service file.
sudo sh <bamboo-agent-home>/bin/bamboo-agent.sh install
This will generate a new systemd service file with the correct configuration. Finally, restart the Bamboo remote agent service.
ソリューション 2
If you prefer not to delete the systemd service file, simply edit the file and change the service type from 'simple' to 'forking'.
[Unit]
Description=Bamboo Agent
After=syslog.target network.target
[Service]
Type=forking
....
Finally do a reload of the service and restart the service.
# systemctl daemon-reload
# systemctl start bamboo-agent.service