Stale pid file may cause the launch script to incorrectly report that the service is running if a new process has been allocated the same pid #25651
Labels
status: declined
A suggestion or change that we don't feel we should currently apply
type: bug
A general bug
Spring Boot version : 2.2.4.RELEASE
OS (uname -a) : Linux hostname 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
On a Linux server, there is an init.d "service_name" service implemented as a Spring Boot "executable".
The "service service_name status" Linux command used in supervision returned sometimes "Running", but the service was inactive.
So I run the following in a bash shell to reproduce this bug :
The output contains an error ::
I think I found the root cause of this bug. The Linux command "service service_name status" (with the name of one Linux init.d service implemented as a Spring Boot "executable") uses a process number (PID) to know if the service is active. It is problematic, because when the service is idle (and the PID of its last run was saved), a new unrelated Linux process might be assigned this PID. And the command will then indicate that this service is active, when it is not.
The problematic code is in this file ::
https://github.com/spring-projects/spring-boot/blob/v2.2.4.RELEASE/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script
This file contains ::
The text was updated successfully, but these errors were encountered: