Why do I get a Boot timeout error (Error R10) when running my app on Heroku?

MWB

I have a Java app that I deployed on Heroku. The deployment works like a charm, no errors or warnings and the app starts working. However, after some time, I get the following error:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch

I do not get any error when I am running my app locally.

FYI: this app periodically checks whether or not there are changes made to a table in a postgresql database and, if so, updates another table in that same database (as far as I can see not really relevant to my problem, but here you go).

Here is the log:

2019-02-12T19:37:15.444651+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=24637 -cp target/classes:target/dependency/* com.name.numbersbackend.Main`
2019-02-12T19:37:18.657701+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-02-12T19:37:18.660650+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 
2019-02-12T19:37:35.580329+00:00 app[web.1]: .
2019-02-12T19:37:51.105807+00:00 app[web.1]: .
2019-02-12T19:38:06.683974+00:00 app[web.1]: .
2019-02-12T19:38:22.198062+00:00 app[web.1]: .
2019-02-12T19:38:37.792613+00:00 app[web.1]: .
2019-02-12T19:38:45.489753+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-02-12T19:38:45.489753+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-02-12T19:38:45.663859+00:00 heroku[web.1]: Process exited with status 137
2019-02-12T19:38:45.682773+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-12T19:38:45.766843+00:00 heroku[web.1]: State changed from crashed to starting
2019-02-12T19:38:48.871480+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=39010 -cp target/classes:target/dependency/* com.name.numbersbackend.Main`
2019-02-12T19:38:51.074950+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-02-12T19:38:51.077995+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 
2019-02-12T19:39:07.724633+00:00 app[web.1]: .
2019-02-12T19:39:23.250203+00:00 app[web.1]: .
2019-02-12T19:39:38.760492+00:00 app[web.1]: .
2019-02-12T19:39:54.313859+00:00 app[web.1]: .
2019-02-12T19:40:09.881207+00:00 app[web.1]: .
2019-02-12T19:40:19.374407+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-12T19:40:19.187236+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-02-12T19:40:19.187351+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-02-12T19:40:19.354497+00:00 heroku[web.1]: Process exited with status 137

FYI: The line 2019-02-12T19:39:38.760492+00:00 app[web.1]: . (and lines like this) contains some temporary output from my app to show that it is actually doing something. For each of these lines, the program is checking if there are changes to the table and if so, if it needs to take action (if it does need to take action, the output of the app is more meaningful).

As you can see, the app is starting alright, working for some time, then crashes and even restarts. However, at some point it stops working entirely.

Here is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.name</groupId>
    <artifactId>com.name.app.backend</artifactId>
    <version>1.0</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180813</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.5</version>
        </dependency>
        <dependency>
            <groupId>com.github.myname</groupId>
            <artifactId>app-lib</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

...and my Procfile:

web: java $JAVA_OPTS -Dserver.port=$PORT -cp target/classes:target/dependency/* nl.limakajo.numbersbackend.Main

After a lot of Googling and browsing on SO, I have not found a solution.

codefinger

It sounds like you want this process to run in the background an not handle web requests. If that's the case, you don't want to use web: in your Procfile. On Heroku, the web process is treated specially: it is assigned a PORT env var, which must be bound to in the first 90 seconds after launch.

I recommend changing your Procfile to:

worker: java $JAVA_OPTS -cp target/classes:target/dependency/* nl.limakajo.numbersbackend.Main

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Heroku R10 Boot Timeout Error

Heroku R10 Error while running Spring Boot App

Heroku R10 (Boot Timeout) error with Node app - but not using an HTTP server?

Discord app error R10 when deploying with Heroku

Heroku - why would I get Error R12 (Exit timeout) when pushing a release to Heroku?

Python Twitter Bot w/ Heroku Error: R10 Boot Timeout

Quarkus application deployed on Heroku gives Error R10 (Boot Timeout)

Heroku Node.js - Error R10 (Boot timeout) -> Web process failed to bind to $PORT

(heroku) Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Why do I get a "405 - Method Not Allowed" error when trying to open a .css file in my Spring Boot/Spring Security web app?

Why do I obtain this error when deploying app to Heroku?

How can I fix Error R10 (Boot timeout) on Gatsby JS?

Why do i get this google guava error when running my project?

Why do I get an TypeError: 'in <string>' requires string as left operand, not list error when running my program?

Why do i get an error when running my discord.py code?

Why when i try push my Spring boot app to heroku it return "Fatal error compiling: invalid target release: 11"

Heroku / React / Docusaurus - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Heroku Node.js Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Heroku: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch - Python

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch on HEROKU with React

Heroku - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch using Webpack

My app keeps crashing when i deploy to heroku. i get this wried app error home screen

R10 Error when deploying a Docker image to Heroku

I deployed my app on heroku and I am getting this error on running heroku logs tail "Error connecting to the database"

I keep getting this Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Why do I get a very long timeout in my PlayFramework app?

Why do i get a "terminated due to timeout" error for my code at hackerrank?

Why do I keep getting the axios error in my Django React app on Heroku?

Why do I get the error "A valid Flask application was not obtained from..." when I use the flask cli to run my app?