Skip to content

Conversation

@ivanovac
Copy link
Contributor

Problem

The JRuby Sinatra integration test (TestIntegration/integration/Default/jruby/builds_and_runs_the_jruby_sinatra_app) was consistently failing with the following symptoms:

  • Application staging completed successfully

  • All dependencies (JRuby 9.4.8.0, gems) installed correctly

  • App crashed during startup with health check timeout errors:
    Timed out after 1m0s (30 attempts) waiting for startup check to succeed: failed to make TCP connection to 10.255.255.77:8080: connect: connection refused

  • The app logged "Invoking start command" but never actually listened on port 8080

Root Cause

The default rackup command (generated by the Ruby buildpack for Rack applications) binds only to localhost by default. In Cloud Foundry's container environment, the health check system and router need to connect from outside the container, requiring the application to bind to 0.0.0.0 (all interfaces).

While this works fine for regular Ruby/MRI applications (likely due to differences in how the Ruby runtime handles network binding), JRuby's behavior requires explicit host specification.

Solution

Added a Procfile to the fixtures/default/sinatra_jruby/ test fixture with an explicit start command:

web: bundle exec rackup config.ru -o 0.0.0.0 -p $PORT

The [-o 0.0.0.0] flag ensures the application binds to all network interfaces, allowing Cloud Foundry's health checks and routing to function properly.

Testing

  • Test now passes consistently
  • Application starts successfully and responds to HTTP requests
  • Health checks pass on all retry attempts
  • App correctly returns "jruby 3.1.4" at the /ruby endpoint

Copy link
Contributor

@tnikolova82 tnikolova82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ivanovac ivanovac merged commit e741ba9 into master Dec 19, 2025
7 checks passed
@ivanovac ivanovac deleted the fix-sinatra-app branch December 19, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants