Harry Manoharan
Harry Manoharan

Reputation: 181

Spring Boot application crashes on Heroku code=H10

I have deployed a springboot application on heroku app. The application worked fine for quite a long time. But now suddenly i get an error Code="H10" and the app crashes. The build is successfull when deploying to heroku and also the application works locally as well.

The application is in the git repository : https://github.com/hmanoharan-12/saloncityservice

I get the error when i send a request to the API. eg:- https://saloncityservice.herokuapp.com/getuser

Error in Logs :

2019-11-03T05:56:00.133635+00:00 app[web.1]: at com.webservice.restfulservice.ServiceApplication.main(ServiceApplication.java:10) ~[classes!/:0.0.1-SNAPSHOT]
2019-11-03T05:56:00.133637+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133638+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.13364+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133641+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133642+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2019-11-03T05:56:00.133643+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2019-11-03T05:56:00.133645+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2019-11-03T05:56:00.133646+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2019-11-03T05:56:00.133651+00:00 app[web.1]: Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
2019-11-03T05:56:00.133653+00:00 app[web.1]:
2019-11-03T05:56:00.133654+00:00 app[web.1]: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2019-11-03T05:56:00.133656+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133657+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133658+00:00 app[web.1]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.13366+00:00 app[web.1]: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133661+00:00 app[web.1]: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133663+00:00 app[web.1]: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133664+00:00 app[web.1]: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133666+00:00 app[web.1]: at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133667+00:00 app[web.1]: at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133668+00:00 app[web.1]: at com.mysql.cj.NativeSession.connect(NativeSession.java:150) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.13367+00:00 app[web.1]: at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:947) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133671+00:00 app[web.1]: at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:817) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133673+00:00 app[web.1]: ... 61 common frames omitted
2019-11-03T05:56:00.133675+00:00 app[web.1]: Caused by: java.net.SocketTimeoutException: connect timed out
2019-11-03T05:56:00.133676+00:00 app[web.1]: at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133678+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133679+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.13368+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133682+00:00 app[web.1]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133683+00:00 app[web.1]: at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_222-heroku]
2019-11-03T05:56:00.133684+00:00 app[web.1]: at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.13369+00:00 app[web.1]: at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65) ~[mysql-connector-java-8.0.17.jar!/:8.0.17]
2019-11-03T05:56:00.133694+00:00 app[web.1]: ... 64 common frames omitted
2019-11-03T05:56:00.133695+00:00 app[web.1]:
2019-11-03T05:56:00.213001+00:00 app[web.1]: 2019-11-03 05:56:00.212  INFO 4 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
2019-11-03T05:56:00.213005+00:00 app[web.1]: name: default
2019-11-03T05:56:00.213006+00:00 app[web.1]: ...]
2019-11-03T05:56:00.327049+00:00 app[web.1]: 2019-11-03 05:56:00.326  INFO 4 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.11.Final}
2019-11-03T05:56:00.329135+00:00 app[web.1]: 2019-11-03 05:56:00.328  INFO 4 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2019-11-03T05:56:00.586215+00:00 app[web.1]: 2019-11-03 05:56:00.585  INFO 4 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-11-03T05:56:00.990198+00:00 app[web.1]: 2019-11-03 05:56:00.989  INFO 4 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-11-03T05:56:18.877745+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-11-03T05:56:18.910371+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-11-03T05:56:19.00654+00:00 heroku[web.1]: Process exited with status 137
2019-11-03T05:56:19.052964+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-03T05:56:47.774128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/getuser" host=saloncityservice.herokuapp.com request_id=d15a28c2-0725-45de-a2e9-b41f9e3469d0 fwd="123.231.87.83" dyno= connect= service= status=503 bytes= protocol=https```

Upvotes: 3

Views: 6065

Answers (5)

timolor
timolor

Reputation: 1

I experienced a similar issue. In my own case, the port was hardcoded to a fixed value.
In your application.properties file make sure that server.port is not hardcoded to a port.
Replace server.port=8080 with server.port=${PORT:8080}.

Here it will default to 8080 if the port was not specified

Upvotes: 0

SuperSpamTube
SuperSpamTube

Reputation: 107

I've had the same problem twice. The app runs stably for months and then suddenly this H10 error. For me it is enough if I click on"More" in the top right menu in Heroku and "restart all dynos".

I hope this helps one or the other. I was almost in despair at the time too. If you have a paid account, this probably occurs less often.

Upvotes: 0

Hisyam Zayd
Hisyam Zayd

Reputation: 1

Sorry if I'm a bit too late. I have tried adding procfile, adding a port number in application.properties or application.yml as Heroku website tells, made a new project with Spring Web dependencies alone - none of all this is works. Then when I change from Gradle to Maven, its works... No need to add anything.

Upvotes: 0

Prasun Saurabh
Prasun Saurabh

Reputation: 57

I faced same error a while back and even after adding port as specified in the last answer but without any luck. After going through Heroku documentation,I added Procfile in my project and it worked. Check the documentation below-

https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#the-procfile

Upvotes: 1

codefinger
codefinger

Reputation: 10318

Make sure you're passing --server.port=$PORT as described in the Heroku docs on Setting the HTTP Port for Java Applications

Upvotes: 2

Related Questions