Skip to content

Spring boot application may fail to start with init.d due to race condition in start-stop-daemon #4524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hoene opened this issue Nov 17, 2015 · 11 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@hoene
Copy link

hoene commented Nov 17, 2015

Hello,

I am starting a spring boot application as a service with /etc/init.d/

However, the init.d script stops with return code 1 and the message "failed to start".

To my understanding, the start-stop-daemon does not produce the pid file immediately.

Thus, "pid=$(cat "$pid_file")" is returning an empty string. I added a sleep 1 before this line, that helps for the moment.

@wilkinsona
Copy link
Member

@Choene What OS are you running on?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 17, 2015
@hoene
Copy link
Author

hoene commented Nov 17, 2015

Ubuntu 14.04, 64 bit

Linux tuebingen03 3.16.0-53-generic #72~14.04.1-Ubuntu SMP Fri Nov 6 18:17:23
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Andy Wilkinson notifications@github.com hat am 17. November 2015 um 13:34
geschrieben:

@Choene What OS are you running on?


Reply to this email directly or view it on GitHub:
#4524 (comment)

Symonics GmbH
Sand 13
72076 Tübingen
Tel +49 7071 5681302
Fax +49 7071 5681309
Email: christian.hoene@symonics.com
Geschäftsführer/President: Dr. Christian Hoene
Sitz der Gesellschaft/Place of Business: Tübingen
Registereintrag/Commercial Register: Amtsgericht Stuttgart, HRB 739918

@wilkinsona
Copy link
Member

Thanks. I'm surprised we haven't seen this in our testing, I guess we've just got lucky with the timings and never managed to trigger the race condition. This would appear to be a known issue when --make-pidfile and --background are used together.

@wilkinsona wilkinsona removed the status: waiting-for-feedback We need additional information before we can continue label Nov 17, 2015
@wilkinsona wilkinsona added this to the 1.3.1 milestone Nov 17, 2015
@wilkinsona wilkinsona added the type: bug A general bug label Nov 17, 2015
@wilkinsona wilkinsona changed the title Spring boot application fails to start with init.d and start-stop-daemon Spring boot application fails to start with init.d due to race condition in start-stop-daemon Nov 17, 2015
@wilkinsona wilkinsona changed the title Spring boot application fails to start with init.d due to race condition in start-stop-daemon Spring boot application may fail to start with init.d due to race condition in start-stop-daemon Nov 17, 2015
@vpavic
Copy link
Contributor

vpavic commented Nov 18, 2015

Is this limited to Debian-based OS's?
One of our test systems is running Ubuntu 14.04.3 LTS, but I also didn't happen to hit this in testing.

@ukjbrown
Copy link

Also experiencing this issue.
Ubuntu 14.04.3 LTS
Linux (...) 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

@hypery2k
Copy link

same issue with Debian: 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u5 x86_64 GNU/Linux

@pmvilaca
Copy link

I was using the launch script with Amazon linux and it was working fine. I can confirm the issue with ubuntu 14.04 as well

@wilkinsona wilkinsona self-assigned this Dec 1, 2015
@wilkinsona
Copy link
Member

Reopening to fix some issues reported by Shellcheck. Thanks, @php-coder

@wilkinsona wilkinsona reopened this Dec 1, 2015
@jasperblues
Copy link

Is there a way to apply the fix to current versions of boot via gradle?

@vpavic
Copy link
Contributor

vpavic commented Dec 11, 2015

Check the documentation on repackage configuration.

You could include the current version of the script in your project and use embeddedLaunchScript option to point to it.

@jasperblues
Copy link

Thank you @vpavic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

7 participants