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
StackOverflowError on repeated health checks #5228
Comments
Well it sounds like something is causing it to build a deeper and deeper stack as it goes and eventually at 1100 or so hits it's too deep to execute. Looking at the stack trace, I see a lot of this:
From this is looks like a def respond_to?(*args)
return false if args.first.to_s =~ /^to_ary$/
super or @body.respond_to?(*args)
end It would seem to me that the |
A few ideas for investigating this:
Note that the rack code is not significantly different in recent versions. |
I looked at a dump the other day, and saw only one copy of the MiddlewareHealthCheck object; however, |
Thank you for verifying on MRI...I'm glad it did not turn out to be a bug in JRuby. |
Hi:
I set up a middleware health check whick eventually triggers a stack overflow on JRuby.
The same health check works flawlessly on MRI Ruby.
I followed a template from ThisData.com: https://thisdata.com/blog/making-a-rails-health-check-that-doesnt-hit-the-database/
This health check is designed to have a very light touch, and doesn't access the database. I have tried two approaches; one matches the "ThisData" approach exactly, while the other makes a minor change in the health check class (the health check class file is attached).
I have used JMeter to have a single thread access the /health_check URL 1500 times, with a delay of 0.5 after each attempt.
I have also used a 1 second delay. The stack overflow typically occurs consistently shortly after 1100 accesses.
My production servers are on FreeBSD. I use HAProxy to perform the health checks there, and have used intervals up to 60 seconds. Regardless of the interval, the Java process eventually crashes, roughly in proportion to the check interval, with a signal 6 error:
JRuby version: JRuby 9.1.15.0/JRuby 9.2.0.0 (tested on both with identical results)
JAVA_OPTS="-Xmn1024m -ms3072m -mx3072m" (I have tried others)
Rails: 4.2.10
Production environment
FreeBSD: 11.1-RELEASE-p10
Java version on FreeBSD:
openjdk version "1.8.0_162"
OpenJDK Runtime Environment (build 1.8.0_162-b12)
OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode
Development environment
Debian: Linux bdrld-debian 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
Java version on Debian:
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-1~deb9u1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
I have attached a zip file containing the following:
health_check_failure.zip
health_check_failure.zip
The text was updated successfully, but these errors were encountered: