Passenger startup failure on Heroku Cache Control - heroku

I am receiving a startup error for two of my projects when deploying to Heroku. Both work fine locally, it seems like the worker startup of sidekiq causes problems for passenger. I don't really understand where the problem could come from and have checked my procfile, my sidekiq conf and other elements. Any input would be much appreciated.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9294 67/7fd6fe14d700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /app: An error occured while starting up the preloader.
Nov 03 01:25:15 zugone-production app/web.1: Error ID: 1a5af3e4
Nov 03 01:25:15 zugone-production app/web.1: Error details saved to: /tmp/passenger-error-UjpmyP.html
Nov 03 01:25:15 zugone-production app/web.1: Message from application: /app/vendor/bundle/ruby/2.0.0/gems/heroku-deflater-0.6.1/lib/heroku-deflater/serve_zipped_assets.rb:15: syntax error, unexpected ':', expecting =>
Nov 03 01:25:15 zugone-production app/web.1: ...= { headers: { 'Cache-Control': cache_control } } if Rails::...
Nov 03 01:25:15 zugone-production app/web.1: ... ^ (SyntaxError)
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/heroku-deflater-0.6.1/lib/heroku-deflater/railtie.rb:3:in `<top (required)>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/heroku-deflater-0.6.1/lib/heroku-deflater.rb:1:in `<top (required)>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/config/application.rb:9:in `<top (required)>'
Nov 03 01:25:15 zugone-production app/web.1: /app/config/environment.rb:2:in `require'
Nov 03 01:25:15 zugone-production app/web.1: /app/config/environment.rb:2:in `<top (required)>'
Nov 03 01:25:15 zugone-production app/web.1: config.ru:3:in `require'
Nov 03 01:25:15 zugone-production app/web.1: config.ru:3:in `block in <main>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
Nov 03 01:25:15 zugone-production app/web.1: config.ru:1:in `new'
Nov 03 01:25:15 zugone-production app/web.1: config.ru:1:in `<main>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/passenger-5.0.21/src/helper-scripts/rack-preloader.rb:110:in `eval'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/passenger-5.0.21/src/helper-scripts/rack-preloader.rb:110:in `preload_app'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/passenger-5.0.21/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/passenger-5.0.21/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
Nov 03 01:25:15 zugone-production app/web.1: /app/vendor/bundle/ruby/2.0.0/gems/passenger-5.0.21/src/helper-scripts/rack-preloader.rb:29:in `<main>'
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9793 67/7fd6dbfff700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 3-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9801 67/7fd6f6ffe700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9803 67/7fd6f5ffd700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 2-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9806 67/7fd6c3fff700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 6-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9807 67/7fd6c1ffd700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 8-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9809 67/7fd6c2ffe700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 7-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9811 67/7fd6daffe700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 4-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:15 zugone-production app/web.1: [ 2015-11-03 09:25:14.9812 67/7fd6d9ffd700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 5-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 1a5af3e4. Please see earlier logs for details about the error.
Nov 03 01:25:16 zugone-production heroku/router: at=info method=GET path="/" host=www.zug-erstattung.de request_id=39412581-e55c-4e29-8730-c4c1694b660b fwd="172.21.225.211,130.238.98.89" dyno=web.1 connect=1ms service=5903ms status=500 bytes=2847
Nov 03 01:25:16 zugone-production app/worker.1: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require': /app/vendor/bundle/ruby/2.0.0/gems/heroku-deflater-0.6.1/lib/heroku-deflater/serve_zipped_assets.rb:15: syntax error, unexpected ':', expecting => (SyntaxError)
Nov 03 01:25:16 zugone-production app/worker.1: ...= { headers: { 'Cache-Control': cache_control } } if Rails::...
Nov 03 01:25:16 zugone-production app/worker.1: ... ^

I had same problem as following 1 hour ago.
SyntaxError:
/app/vendor/bundle/ruby/2.1.0/gems/heroku-deflater-0.6.1/lib/heroku-deflater/serve_zipped_assets.rb:15:
syntax error, unexpected ':', expecting => ...= { headers: {
'Cache-Control': cache_control } } if Rails::...
It seems that heroku-deflater was updated 21 hours ago.
Though I don't know the reason this error is caused at all,
I was able to make my apps work well on Heroku by define heroku-deflater version on Gemfile like this.
■ Gemfile
gem 'heroku-deflater', '0.5.3 ', :group => :production
I would like to wait that heroku-deflater will be updated again.
Thank you!

Related

Thorntail app on Heroku with JVM metrics enabled

When I enable Heroku's JVM metrics on my working Thorntail 2.2.0 app, the app fails at startup, and strange errors occur...
Obviously, it has something to do with :
2018-10-08T19:11:34.512200+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -javaagent:/app/.heroku/bin/heroku-metrics-agent.jar
Any idea ?
Here is the full startup log :
2018-10-08T19:10:52.554331+00:00 heroku[web.1]: State changed from crashed to starting
2018-10-08T19:11:30.516536+00:00 heroku[web.1]: Starting process with command `java -Djava.net.preferIPv4Stack=true -Xmx224m -Xss512k -Dswarm.datasources.data-sources.XXX.connection-url=jdbc:mysql://XXX/XXX -Dswarm.datasources.data-sources.XXX.driver-name=mysql -Dswarm.datasources.data-sources.XXX.user-name=XXX -Dswarm.datasources.data-sources.XXX.password=XXX -Dswarm.datasources.data-sources.XXX.validate-on-match=true -Dswarm.datasources.data-sources.XXX.background-validation=true "-Dswarm.http.port=8366" -jar adi-web/XXX-webapp/build/libs/XXX-webapp-hollow-thorntail.jar XXX-web/XXX-webapp/build/libs/XXX.war`
2018-10-08T19:11:34.141406+00:00 app[web.1]: [heroku-exec] Starting
2018-10-08T19:11:34.512200+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -javaagent:/app/.heroku/bin/heroku-metrics-agent.jar
2018-10-08T19:12:35.905056+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.905064+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JAX-RS - STABLE io.thorntail:jaxrs:2.2.0.Final
2018-10-08T19:12:35.908249+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.908256+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Logging - STABLE io.thorntail:logging:2.2.0.Final
2018-10-08T19:12:35.925744+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.925748+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Elytron - STABLE io.thorntail:elytron:2.2.0.Final
2018-10-08T19:12:35.935554+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.935558+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JPA - STABLE io.thorntail:jpa:2.2.0.Final
2018-10-08T19:12:35.946180+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.946183+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Undertow - STABLE io.thorntail:undertow:2.2.0.Final
2018-10-08T19:12:35.984719+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.984724+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Bean Validation - STABLE io.thorntail:bean-validation:2.2.0.Final
2018-10-08T19:12:35.998796+00:00 app[web.1]: Oct 08, 2018 7:12:35 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:35.998800+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JCA - STABLE io.thorntail:jca:2.2.0.Final
2018-10-08T19:12:36.020240+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.020244+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Transactions - STABLE io.thorntail:transactions:2.2.0.Final
2018-10-08T19:12:36.028312+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.028317+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JSF - STABLE io.thorntail:jsf:2.2.0.Final
2018-10-08T19:12:36.032955+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.032959+00:00 app[web.1]: INFO: THORN0013: Installed fraction: CDI Configuration - STABLE io.thorntail:cdi-config:2.2.0.Final
2018-10-08T19:12:36.047870+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.047874+00:00 app[web.1]: INFO: THORN0013: Installed fraction: CDI - STABLE io.thorntail:cdi:2.2.0.Final
2018-10-08T19:12:36.088953+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.088957+00:00 app[web.1]: INFO: THORN0013: Installed fraction: EJB - STABLE io.thorntail:ejb:2.2.0.Final
2018-10-08T19:12:36.095022+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.095026+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Datasources - STABLE io.thorntail:datasources:2.2.0.Final
2018-10-08T19:12:36.101204+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.101208+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JAX-RS with JSON-P - STABLE io.thorntail:jaxrs-jsonp:2.2.0.Final
2018-10-08T19:12:36.102051+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.102054+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JAX-RS with Multipart - STABLE io.thorntail:jaxrs-multipart:2.2.0.Final
2018-10-08T19:12:36.131170+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.131174+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Web - STABLE io.thorntail:web:2.2.0.Final
2018-10-08T19:12:36.137655+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.137659+00:00 app[web.1]: INFO: THORN0013: Installed fraction: Hibernate Validator - STABLE io.thorntail:hibernate-validator:2.2.0.Final
2018-10-08T19:12:36.156735+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.156772+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JAX-RS with Validation - STABLE io.thorntail:jaxrs-validator:2.2.0.Final
2018-10-08T19:12:36.162066+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.wildfly.swarm.container.runtime.ServerBootstrapImpl logFraction
2018-10-08T19:12:36.162070+00:00 app[web.1]: INFO: THORN0013: Installed fraction: JAX-RS with JAXB - STABLE io.thorntail:jaxrs-jaxb:2.2.0.Final
2018-10-08T19:12:36.977514+00:00 app[web.1]: Oct 08, 2018 7:12:36 PM org.jboss.weld.bootstrap.WeldStartup
2018-10-08T19:12:36.977528+00:00 app[web.1]: INFO: WELD-000900: 2.4.3 (Final)
2018-10-08T19:12:37.024143+00:00 app[web.1]: Oct 08, 2018 7:12:37 PM org.jboss.weld.util.ServiceLoader loadClass
2018-10-08T19:12:37.024151+00:00 app[web.1]: WARNING: Could not load service class org.wildfly.swarm.cdi.config.deployment.InjectConfigViewExtension
2018-10-08T19:12:37.062068+00:00 app[web.1]: Oct 08, 2018 7:12:37 PM org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory create
2018-10-08T19:12:37.062074+00:00 app[web.1]: INFO: WELD-ENV-000020: Using jandex for bean discovery
2018-10-08T19:12:41.971025+00:00 app[web.1]: Oct 08, 2018 7:12:41 PM org.jboss.weld.bootstrap.WeldStartup startContainer
2018-10-08T19:12:41.971044+00:00 app[web.1]: INFO: WELD-000101: Transactional services not available. Injection of #Inject UserTransaction not available. Transactional observers will be invoked synchronously.
2018-10-08T19:12:47.095661+00:00 app[web.1]: Oct 08, 2018 7:12:47 PM org.jboss.weld.interceptor.reader.InterceptorMetadataUtils isValidTargetClassLifecycleInterceptorMethod
2018-10-08T19:12:47.095675+00:00 app[web.1]: WARN: WELD-001471: Interceptor method postConstruct defined on class org.wildfly.swarm.container.runtime.wildfly.ShrinkWrapFileSystem is not defined according to the specification. It should not throw java.io.IOException, which is a checked exception.
2018-10-08T19:12:47.095678+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.wildfly.ShrinkWrapFileSystem.postConstruct(ShrinkWrapFileSystem.java:0)
2018-10-08T19:12:47.095680+00:00 app[web.1]: StackTrace
2018-10-08T19:12:47.097952+00:00 app[web.1]: Oct 08, 2018 7:12:47 PM org.jboss.weld.interceptor.reader.InterceptorMetadataUtils isValidTargetClassLifecycleInterceptorMethod
2018-10-08T19:12:47.097963+00:00 app[web.1]: WARN: WELD-001471: Interceptor method setupFactories defined on class org.wildfly.swarm.container.runtime.xmlconfig.StandaloneXMLParserProducer is not defined according to the specification. It should not throw java.lang.Exception, which is a checked exception.
2018-10-08T19:12:47.097966+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.xmlconfig.StandaloneXMLParserProducer.setupFactories(StandaloneXMLParserProducer.java:0)
2018-10-08T19:12:47.097968+00:00 app[web.1]: StackTrace
2018-10-08T19:12:47.461880+00:00 app[web.1]: Oct 08, 2018 7:12:47 PM org.jboss.weld.environment.se.WeldContainer fireContainerInitializedEvent
2018-10-08T19:12:47.461891+00:00 app[web.1]: INFO: WELD-ENV-002003: Weld SE container internal initialized
2018-10-08T19:12:49.530773+00:00 app[web.1]: Oct 08, 2018 7:12:49 PM org.wildfly.swarm.datasources.runtime.DatasourceAndDriverCustomizer attemptInstallation
2018-10-08T19:12:49.530785+00:00 app[web.1]: INFO: THORN1003: Auto-detected JDBC driver for mysql
2018-10-08T19:12:52.625954+00:00 app[web.1]: Oct 08, 2018 7:12:52 PM org.jboss.msc.service.ServiceContainerImpl
2018-10-08T19:12:52.625973+00:00 app[web.1]: INFO: JBoss MSC version 1.2.7.SP1
2018-10-08T19:12:52.975271+00:00 app[web.1]: Oct 08, 2018 7:12:52 PM org.jboss.as.server.ApplicationServerService start
2018-10-08T19:12:52.975283+00:00 app[web.1]: INFO: WFLYSRV0049: Thorntail 2.2.0.Final (WildFly Core 3.0.8.Final) starting
2018-10-08T19:12:53.350956+00:00 app[web.1]: Oct 08, 2018 7:12:53 PM org.wildfly.swarm.container.runtime.cli.CommandLineArgsServiceActivator activate
2018-10-08T19:12:53.350968+00:00 app[web.1]: INFO: THORN0019: Install MSC service for command line args: [XXX-web/XXX-webapp/build/libs/XXX.war]
2018-10-08T19:12:57.444531+00:00 app[web.1]: Oct 08, 2018 7:12:57 PM org.jboss.as.controller.AbstractOperationContext executeStep
2018-10-08T19:12:57.444543+00:00 app[web.1]: ERROR: WFLYCTL0013: Operation ("parallel-extension-add") failed - address: ([])
2018-10-08T19:12:57.444545+00:00 app[web.1]: java.lang.RuntimeException: WFLYCTL0079: Failed initializing module org.jboss.as.logging
2018-10-08T19:12:57.444551+00:00 app[web.1]: at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:115)
2018-10-08T19:12:57.444553+00:00 app[web.1]: at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:980)
2018-10-08T19:12:57.444554+00:00 app[web.1]: at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:726)
2018-10-08T19:12:57.444556+00:00 app[web.1]: at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:450)
2018-10-08T19:12:57.444557+00:00 app[web.1]: at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1402)
2018-10-08T19:12:57.444559+00:00 app[web.1]: at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:490)
2018-10-08T19:12:57.444560+00:00 app[web.1]: at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:468)
2018-10-08T19:12:57.444562+00:00 app[web.1]: at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:430)
2018-10-08T19:12:57.444563+00:00 app[web.1]: at org.jboss.as.server.ServerService.boot(ServerService.java:437)
2018-10-08T19:12:57.444565+00:00 app[web.1]: at org.jboss.as.server.ServerService.boot(ServerService.java:396)
2018-10-08T19:12:57.444567+00:00 app[web.1]: at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
2018-10-08T19:12:57.444569+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-10-08T19:12:57.444572+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
2018-10-08T19:12:57.444574+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-10-08T19:12:57.444576+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-10-08T19:12:57.444577+00:00 app[web.1]: at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:107)
2018-10-08T19:12:57.444580+00:00 app[web.1]: ... 11 more
2018-10-08T19:12:57.444582+00:00 app[web.1]: Caused by: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
2018-10-08T19:12:57.444584+00:00 app[web.1]: at org.jboss.as.logging.LoggingExtension.initialize(LoggingExtension.java:167)
2018-10-08T19:12:57.444585+00:00 app[web.1]: at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:131)
2018-10-08T19:12:57.444587+00:00 app[web.1]: at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:104)
2018-10-08T19:12:57.444594+00:00 app[web.1]: at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:144)
2018-10-08T19:12:57.444596+00:00 app[web.1]: at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127)
2018-10-08T19:12:57.444597+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2018-10-08T19:12:57.444599+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2018-10-08T19:12:57.444601+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2018-10-08T19:12:57.444602+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-10-08T19:12:57.444604+00:00 app[web.1]: at org.jboss.threads.JBossThread.run(JBossThread.java:320)
2018-10-08T19:12:57.444605+00:00 app[web.1]:
2018-10-08T19:12:57.550906+00:00 app[web.1]: Oct 08, 2018 7:12:57 PM org.jboss.as.server.ServerService$4 logExit
2018-10-08T19:12:57.550914+00:00 app[web.1]: FATAL: WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
2018-10-08T19:12:57.610496+00:00 app[web.1]: java.lang.RuntimeException: java.util.concurrent.ExecutionException: Operation failed
2018-10-08T19:12:57.613703+00:00 app[web.1]: at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2018-10-08T19:12:57.613954+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
2018-10-08T19:12:57.614003+00:00 app[web.1]: at org.wildfly.swarm.Swarm.start(Swarm.java:398)
2018-10-08T19:12:57.614071+00:00 app[web.1]: at org.wildfly.swarm.Swarm.main(Swarm.java:742)
2018-10-08T19:12:57.614650+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-10-08T19:12:57.614695+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-10-08T19:12:57.614734+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-10-08T19:12:57.615007+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498)
2018-10-08T19:12:57.615056+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:53)
2018-10-08T19:12:57.616224+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.Main.run(Main.java:132)
2018-10-08T19:12:57.616292+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.Main.main(Main.java:85)
2018-10-08T19:12:57.616664+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: Operation failed
2018-10-08T19:12:57.617097+00:00 app[web.1]: at org.jboss.threads.AsyncFutureTask.operationFailed(AsyncFutureTask.java:74)
2018-10-08T19:12:57.617154+00:00 app[web.1]: at org.jboss.threads.AsyncFutureTask.get(AsyncFutureTask.java:268)
2018-10-08T19:12:57.617431+00:00 app[web.1]: at org.wildfly.swarm.internal.wildfly.SelfContainedContainer.start(SelfContainedContainer.java:147)
2018-10-08T19:12:57.617478+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:213)
2018-10-08T19:12:57.617676+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source)
2018-10-08T19:12:57.679602+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:159)
2018-10-08T19:12:57.679933+00:00 app[web.1]: at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43)
2018-10-08T19:12:57.679972+00:00 app[web.1]: ... 10 more
2018-10-08T19:12:57.683415+00:00 app[web.1]: Caused by: java.lang.Exception: WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
2018-10-08T19:12:57.683485+00:00 app[web.1]: at org.jboss.as.server.BootstrapListener.bootFailure(BootstrapListener.java:87)
2018-10-08T19:12:57.683530+00:00 app[web.1]: at org.jboss.as.server.ServerService.boot(ServerService.java:417)
2018-10-08T19:12:57.683561+00:00 app[web.1]: at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
2018-10-08T19:12:57.683597+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-10-08T19:12:57.683704+00:00 app[web.1]: java.lang.RuntimeException: java.util.concurrent.ExecutionException: Operation failed
2018-10-08T19:12:57.683756+00:00 app[web.1]: at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2018-10-08T19:12:57.683786+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
2018-10-08T19:12:57.683821+00:00 app[web.1]: at org.wildfly.swarm.Swarm.start(Swarm.java:398)
2018-10-08T19:12:57.683880+00:00 app[web.1]: at org.wildfly.swarm.Swarm.main(Swarm.java:742)
2018-10-08T19:12:57.683942+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-10-08T19:12:57.684004+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-10-08T19:12:57.684034+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-10-08T19:12:57.684088+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498)
2018-10-08T19:12:57.684136+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:53)
2018-10-08T19:12:57.684184+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.Main.run(Main.java:132)
2018-10-08T19:12:57.684223+00:00 app[web.1]: at org.wildfly.swarm.bootstrap.Main.main(Main.java:85)
2018-10-08T19:12:57.684272+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: Operation failed
2018-10-08T19:12:57.684310+00:00 app[web.1]: at org.jboss.threads.AsyncFutureTask.operationFailed(AsyncFutureTask.java:74)
2018-10-08T19:12:57.684352+00:00 app[web.1]: at org.jboss.threads.AsyncFutureTask.get(AsyncFutureTask.java:268)
2018-10-08T19:12:57.684416+00:00 app[web.1]: at org.wildfly.swarm.internal.wildfly.SelfContainedContainer.start(SelfContainedContainer.java:147)
2018-10-08T19:12:57.684450+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:213)
2018-10-08T19:12:57.684480+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source)
2018-10-08T19:12:57.684522+00:00 app[web.1]: at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:159)
2018-10-08T19:12:57.684560+00:00 app[web.1]: at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43)
2018-10-08T19:12:57.684611+00:00 app[web.1]: ... 10 more
2018-10-08T19:12:57.706797+00:00 app[web.1]: Caused by: java.lang.Exception: WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
2018-10-08T19:12:57.706835+00:00 app[web.1]: at org.jboss.as.server.BootstrapListener.bootFailure(BootstrapListener.java:87)
2018-10-08T19:12:57.706895+00:00 app[web.1]: at org.jboss.as.server.ServerService.boot(ServerService.java:417)
2018-10-08T19:12:57.706952+00:00 app[web.1]: at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
2018-10-08T19:12:57.707004+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-10-08T19:12:57.969309+00:00 heroku[web.1]: Process exited with status 1
2018-10-08T19:12:57.986184+00:00 heroku[web.1]: State changed from starting to crashed

Heroku - Ruby error loop

I have not made any changes to ruby files, just a few layout changes and am seeing the following errors in Papertrail on my server. I did some digging by can't seem to find an answer.
Also the same code base is running in a QA system with no errors. Both servers are on the same build, Cedar-14, with the only difference being that the Prod server has a worker Dyno and QA does not.
Feb 01 11:24:46 skincaremarketplace app/worker.1: Don't know how to build
task 'jobs:work'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/bin/bundle:3:in `load'
Feb 01 11:24:46 skincaremarketplace app/worker.1: /app/bin/bundle:3:in `<main>'
Feb 01 11:24:46 skincaremarketplace app/worker.1: (See full trace by running task with --trace)
Feb 01 11:24:46 skincaremarketplace heroku/worker.1: Process exited with status 1
Feb 01 11:40:45 skincaremarketplace heroku/worker.1: State changed from crashed to starting
Feb 01 11:40:52 skincaremarketplace heroku/worker.1: Starting process with command `bundle exec rake jobs:work`
Feb 01 11:40:52 skincaremarketplace heroku/worker.1: State changed from starting to up
Feb 01 11:41:02 skincaremarketplace heroku/worker.1: Process exited with status 1
Feb 01 11:41:02 skincaremarketplace heroku/worker.1: State changed from up to crashed
Feb 01 11:41:02 skincaremarketplace app/worker.1: rake aborted!
Your prod server worker dyno tries to run bundle exec rake jobs:work (check your Procfile). Looks like you don't have that task. It normally should be in lib/tasks/jobs.rake.
If you scale up your QA workers they'll be failing too.
After reviewing the configuration on Heroku, All of our other applications that follow the same pattern, do not use jobs:work, or have a jobs.rake file. The worker was turned on in error. The investigation did shed some light, so thank you Stan.

Rails. First request too slow, times out, the next ones are faster

I'm developing a rails application. After pushing the git on Heroku without trouble, the app show an error "request time out" inside the webbrowser.
If i'm re-trying 1 minute after, the app display the page very quikly on the webbrowser.
CONFIGURATION
Find below my configuration
Rails 5.1.2
psql (PostgreSQL) 9.6.1
The main info inside the gem file:
ruby '2.2.6'
gem 'rails', '~> 5.1.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.7'
Heroku
Standard-2X dynos, Shared, 1 GB RAM
Heroku Postgres :: Brown
Memcached Cloud :free
Papertrail :free
STANDARD PLAN
LOG
The log of the first very long request ( notice that I restart the server before the test to reproduce the problem that append every morning at the first request)
Aug 25 03:28:15 myapplication app/web.1: => Booting Puma
Aug 25 03:28:15 myapplication app/web.1: => Rails 5.1.2 application starting in production on http://0.0.0.0:41080
Aug 25 03:28:15 myapplication app/web.1: => Run `rails server -h` for more startup options
Aug 25 03:28:15 myapplication app/web.1: [4] Puma starting in cluster mode...
Aug 25 03:28:15 myapplication app/web.1: [4] * Version 3.9.1 (ruby 2.2.6-p396), codename: Private Caller
Aug 25 03:28:15 myapplication app/web.1: [4] * Min threads: 5, max threads: 5
Aug 25 03:28:15 myapplication app/web.1: [4] * Environment: production
Aug 25 03:28:15 myapplication app/web.1: [4] * Process workers: 2
Aug 25 03:28:15 myapplication app/web.1: [4] * Preloading application
Aug 25 03:28:15 myapplication app/web.1: [4] * Listening on tcp://0.0.0.0:41080
Aug 25 03:28:15 myapplication app/web.1: [4] Use Ctrl-C to stop
Aug 25 03:28:15 myapplication app/web.1: [4] - Worker 0 (pid: 6) booted, phase: 0
Aug 25 03:28:15 myapplication app/web.1: [4] - Worker 1 (pid: 19) booted, phase: 0
Aug 25 03:28:15 myapplication heroku/web.1: State changed from starting to up
Aug 25 03:28:37 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=2 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.057733 sample#memory-total=4044984kB sample#memory-free=1550168kB sample#memory-cached=1945532kB sample#memory-postgres=16880kB
Aug 25 03:30:38 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=2 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.029687 sample#memory-total=4044984kB sample#memory-free=1550000kB sample#memory-cached=1945544kB sample#memory-postgres=16880kB
Aug 25 03:31:39 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=2 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.029687 sample#memory-total=4044984kB sample#memory-free=1549940kB sample#memory-cached=1945564kB sample#memory-postgres=16880kB
Aug 25 03:32:38 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=2 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.029687 sample#memory-total=4044984kB sample#memory-free=1550284kB sample#memory-cached=1945568kB sample#memory-postgres=16880kB
Aug 25 03:33:39 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=2 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.030191 sample#memory-total=4044984kB sample#memory-free=1550128kB sample#memory-cached=1945580kB sample#memory-postgres=16880kB
Aug 25 03:33:51 myapplication heroku/router: at=info method=GET path="/" host=myapplication.herokuapp.com request_id=afa5c118-7319-4b9b-a945-60ed57a63062 fwd="90.87.43.215" dyno=web.1 connect=0ms service=72ms status=301 bytes=371 protocol=https
Aug 25 03:33:51 myapplication app/web.1: I, [2017-08-25T10:33:50.584824 #19] INFO -- : [afa5c118-7319-4b9b-a945-60ed57a63062] Started GET "/" for 90.87.43.215 at 2017-08-25 10:33:50 +0000
Aug 25 03:33:51 myapplication app/web.1: I, [2017-08-25T10:33:50.665212 #19] INFO -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Started GET "/projets/new" for 90.87.43.215 at 2017-08-25 10:33:50 +0000
Aug 25 03:33:51 myapplication app/web.1: I, [2017-08-25T10:33:50.670054 #19] INFO -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Processing by ProjetsController#new as HTML
Aug 25 03:33:51 myapplication app/web.1: D, [2017-08-25T10:33:50.783930 #19] DEBUG -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] User Load (3.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]
Aug 25 03:33:51 myapplication app/web.1: D, [2017-08-25T10:33:50.928475 #19] DEBUG -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Regleconfiguration Load (3.4ms) SELECT "regleconfigurations".* FROM "regleconfigurations" ORDER BY "regleconfigurations"."id" DESC LIMIT $1 [["LIMIT", 1]]
Aug 25 03:33:51 myapplication app/web.1: D, [2017-08-25T10:33:50.955570 #19] DEBUG -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Tarifoptionbt Load (3.2ms) SELECT "tarifoptionbts".* FROM "tarifoptionbts"
Aug 25 03:33:51 myapplication app/web.1: I, [2017-08-25T10:33:50.989799 #19] INFO -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Rendering projets/new.html.erb within layouts/application
Aug 25 03:34:21 myapplication heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/projets/new" host=myapplication.herokuapp.com request_id=6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61 fwd="90.87.43.215" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
Aug 25 03:34:39 myapplication app/heroku-postgres: source=HEROKU_POSTGRESQL_BROWN sample#current_transaction=2339 sample#db_size=25066008bytes sample#tables=21 sample#active-connections=3 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99931 sample#table-cache-hit-rate=0.996 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.029687 sample#memory-total=4044984kB sample#memory-free=1547512kB sample#memory-cached=1945596kB sample#memory-postgres=20036kB
Aug 25 03:35:37 myapplication app/web.1: I, [2017-08-25T10:35:37.131381 #19] INFO -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Rendered projets/_etapebar.html.erb (106132.4ms)
[.....] render 30 partial view
Aug 25 03:35:38 myapplication app/web.1: I, [2017-08-25T10:35:37.495939 #19] INFO -- : [6db31a1a-39a5-4a8f-9ba1-cf35ceae5f61] Completed 200 OK in 106826ms (Views: 106499.5ms | ActiveRecord: 50.2ms)
If I render a second time the same view I get this log:
Aug 25 05:42:45 myapplication app/web.1: I, [2017-08-25T12:42:44.339695 #19] INFO -- : [9c38a6b8-73d4-4e31-9ac3-df2ec8b21049] Started GET "/projets/new" for 90.87.43.215 at 2017-08-25 12:42:44 +0000
Aug 25 05:42:45 myapplication app/web.1: I, [2017-08-25T12:42:44.341197 #19] INFO -- : [9c38a6b8-73d4-4e31-9ac3-df2ec8b21049] Processing by ProjetsController#new as HTML
Aug 25 05:42:45 myapplication app/web.1: D, [2017-08-25T12:42:44.348612 #19] DEBUG -- : [9c38a6b8-73d4-4e31-9ac3-df2ec8b21049] User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]
Aug 25 05:42:45 myapplication app/web.1: I, [2017-08-25T12:42:44.351579 #19] INFO -- : [9c38a6b8-73d4-4e31-9ac3-df2ec8b21049] Completed 200 OK in 10ms (ActiveRecord: 1.7ms)
The application jump from a 106 second to serve a first request ( that's create a Heroku error) to a very short time in a second render
ASSET
Log show that the second call get asset from request.
In my app, on each page, I load the js of the current controller:
in application.html.erb
<%= stylesheet_link_tag controller.controller_name if TarifsDynamique::Application.assets.find_asset("#{controller.controller_name}.css") %>
<%= javascript_include_tag params[:controller] if TarifsDynamique::Application.assets.find_asset("#{controller.controller_name}.js") %>
and in from application.js and .css, i remove //=require .
and in asset.rb , I add
Rails.application.config.assets.precompile += ["#{controller}.js", "#{controller}.css"]
whith all the controller.
It's work find ( in devvellpoment and in production after the first call).
but when, I try to
$Heroku run assets:precompile
I got this error
Running rake assets:precompile on ⬢ myapplication... up, run.9829 (Standard-1X)
Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
...
CACHE
I try to add cache to speed up the first page
cache action inside the controler:
class ProjetsController < ApplicationController
caches_action :new, :edit
cache the view: new.html.erb
<%= render 'form', projet: #projet, cached: true %>
active cache inside production.rb
Rails.application.configure do
config.cache_classes = true
NO IDEA
I have no more idea
If you get an idea , its will be so helpfull !
Thanks.
[EDIT]
SOLUTION
Hi,
I finally found what's going on !
I have 50 images to compile in the asset folder.
Even if I precompile them, at the first request after a long sleep, Rails precompile them again that take tomany time.
1- I move image on amason S3,
2- change image_tag to image_static_tag
3- create a image_static_tag helper that serve static file from s3
4- redeploy the app and now everything is ok !!
THANKS FOR YOUR HELP

Saving multiple objects in rails activerecord

I have a recurring job with Rails + Heroku scheduler.rake.
The problem is that it won't save them successfully when it has too many entries.
How can I change this code to make all save completed without error?
This method doesn't need to complete quickly since it will work in the fixed time in the morning, so I am ok to save it one by one with some delay.
(I am using Heroku web and worker each 1x, 25$/month)
Thanks!
*Edited with error logs 2017/02/08
class RecurringEntryJob < ActiveJob::Base
queue_as :default
def perform(*args)
# Get active recurring entries
recurring_entries = Recurring.where(deleted: false)
Rails.logger.info "Recurring_Entry_Called"
for recurring_entry in recurring_entries
Rails.logger.info "“Recurring_Entry Processing for - #{recurring_entry[:id]}"
# Get the current time with saved timezone
timezone = recurring_entry["timezone"]
current_time = Time.now.in_time_zone(timezone)
setDate = recurring_entry["date"]
# Check if daily is set
if setDate == 0 ||
# Checkc if weekday matches
setDate == current_time.wday + 1 ||
# Check if monthly date or end of month match
setDate == current_time.day + 7 || current_time.tomorrow.day == 1 && setDate == 36
Rails.logger.info "Recurring_Entry Day of the week check passed for - #{recurring_entry[:id]}"
# Save an entry at AM4:00
if current_time.hour == 4
Rails.logger.info "Recurring_Entry All cheks passed for - #{recurring_entry[:id]} - creating entry"
# Create entry
entry = Entry.new
entry.user = User.find(recurring_entry["user_id"])
entry.reason = Reason.find_by!(uuid: recurring_entry["reason_uuid"])
entry.account = Account.find_by!(uuid: recurring_entry["account_uuid"])
entry.uuid = SecureRandom.uuid
entry.memo = recurring_entry["memo"]
entry.date = current_time
entry.price = recurring_entry["price"]
entry.is_expense = recurring_entry["is_expense"]
entry.updated_mobile = current_time
entry.reason_uuid = recurring_entry["reason_uuid"]
entry.account_uuid = recurring_entry["account_uuid"]
entry.project_uuid = recurring_entry["project_uuid"]
entry.save!
end
end
end
end
end
Error logs
Feb 08 04:10:51 taxnote heroku/scheduler.5289: Starting process with command `bundle exec rake recurring_entry`
Feb 08 04:10:51 taxnote heroku/scheduler.5289: State changed from starting to up
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Performing RecurringEntryJob from Inline(default)
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Recurring_Entry_Called
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 102
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 88
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 89
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 92
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 93
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 94
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 95
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 96
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 98
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 97
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 99
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 103
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 104
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 105
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 106
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Recurring_Entry Day of the week check passed for - 106
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Recurring_Entry All cheks passed for - 106 - creating entry
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 107
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 108
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 109
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 110
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 111
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 112
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 113
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 115
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 114
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 87
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 138
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 117
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] “Recurring_Entry Processing for - 118
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Recurring_Entry Day of the week check passed for - 118
Feb 08 04:10:57 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Recurring_Entry All cheks passed for - 118 - creating entry
Feb 08 04:10:58 taxnote app/scheduler.5289: [ActiveJob] [RecurringEntryJob] [88810de1-fffb-4e16-b8f8-17712bc5b084] Performed RecurringEntryJob from Inline(default) in 260.25ms
Feb 08 04:10:58 taxnote app/scheduler.5289: rake aborted!
Feb 08 04:10:58 taxnote app/scheduler.5289: ActiveRecord::RecordNotFound: Couldn't find Account
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/core.rb:196:in `find_by!'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/app/jobs/recurring_entry_job.rb:42:in `block in perform'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/app/jobs/recurring_entry_job.rb:11:in `perform'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/execution.rb:32:in `block in perform_now'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `instance_exec'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `block in make_lambda'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:342:in `block in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:43:in `block in tag_logger'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `block in tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in `tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:43:in `tag_logger'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `instance_exec'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `block in make_lambda'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:342:in `block in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/execution.rb:31:in `perform_now'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/execution.rb:21:in `execute'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/queue_adapters/inline_adapter.rb:14:in `enqueue'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/enqueuing.rb:71:in `block in enqueue'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:14:in `block (3 levels) in <module:Logging>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:43:in `block in tag_logger'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `block in tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in `tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `tagged'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:43:in `tag_logger'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/logging.rb:13:in `block (2 levels) in <module:Logging>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `instance_exec'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:441:in `block in make_lambda'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:342:in `block in simple'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_enqueue_callbacks'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/enqueuing.rb:67:in `enqueue'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/activejob-4.2.6/lib/active_job/enqueuing.rb:17:in `perform_later'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/lib/tasks/scheduler.rake:4:in `block in <top (required)>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bugsnag-4.0.2/lib/bugsnag/rake.rb:12:in `execute_with_bugsnag'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/bin/bundle:3:in `load'
Feb 08 04:10:58 taxnote app/scheduler.5289: /app/bin/bundle:3:in `<main>'
Feb 08 04:10:58 taxnote app/scheduler.5289: Tasks: TOP => recurring_entry
Feb 08 04:10:58 taxnote app/scheduler.5289: (See full trace by running task with --trace)
Feb 08 04:10:58 taxnote heroku/scheduler.5289: State changed from up to complete
Feb 08 04:10:58 taxnote heroku/scheduler.5289: Process exited with status 1
What is the exact error you're seeing?
Without seeing the error you're getting, Rails is probably trying to instantiate all of the matching instances of Recurring, and this is taking more memory than you have available. An easy way to attempt to solve this problem is to use find_each rather than instantiating the full result set. This will load the matching records in batches (with a default of 1000 records, but you can configure this to suit.
Recurring.where(deleted: false).find_each do |recurring|
# work on recurring
end
As the error that is happening is when an Account record is not found, you could add some error handling as follows to allow for that.
Recurring.where(deleted: false).find_each do |recurring|
# work on recurring
rescue ActiveRecord::RecordNotFound => e
Rails.logger.error("Account not found: #{recurring.account_uuid}")
next
end
I could fix this issue by checking the error logs, it was because when account part was not founded it stopped the loop.
class RecurringEntryJob < ActiveJob::Base
queue_as :default
def perform(*args)
# Get active recurring entries
recurring_entries = Recurring.where(deleted: false)
Rails.logger.info "Recurring_Entry_Called"
for recurring_entry in recurring_entries
# Rails.logger.info "“Recurring_Entry Processing for - #{recurring_entry[:id]}"
# Get the current time with saved timezone
timezone = recurring_entry["timezone"]
current_time = Time.now.in_time_zone(timezone)
setDate = recurring_entry["date"]
# Check if daily is set
if setDate == 0 ||
# Checkc if weekday matches
setDate == current_time.wday + 1 ||
# Check if monthly date or end of month match
setDate == current_time.day + 7 || current_time.tomorrow.day == 1 && setDate == 36
# Rails.logger.info "Recurring_Entry date check passed for - #{recurring_entry[:id]}"
# Save an entry at AM4:00
if current_time.hour == 4
Rails.logger.info "Recurring_Entry time check passed for - #{recurring_entry[:id]} - creating entry"
# Create entry
entry = Entry.new
entry.user = User.find(recurring_entry["user_id"])
if entry.user.blank?
Rails.logger.info "User Blank for - #{recurring_entry[:id]}"
next
end
entry.reason = Reason.find_by(uuid: recurring_entry["reason_uuid"])
if entry.reason.blank?
Rails.logger.info "Reason Blank for - #{recurring_entry[:id]}"
next
end
entry.account = Account.find_by(uuid: recurring_entry["account_uuid"])
if entry.account.blank?
Rails.logger.info "Account Blank for - #{recurring_entry[:id]}"
next
end
entry.uuid = SecureRandom.uuid
entry.memo = recurring_entry["memo"]
entry.date = current_time
entry.price = recurring_entry["price"]
entry.is_expense = recurring_entry["is_expense"]
entry.updated_mobile = current_time
entry.reason_uuid = recurring_entry["reason_uuid"]
entry.account_uuid = recurring_entry["account_uuid"]
entry.project_uuid = recurring_entry["project_uuid"]
entry.save!
Rails.logger.info "Recurring_Entry Completed for - #{recurring_entry[:id]}"
end
end
end
end
end

Failing to catch Errno::ECONNRESET in Ruby code

In my Rails 3.1 project, deployed to Heroku, I have a rake task that generates a few hundred thousand small PNGs based on records in the database and uploads the results to S3 using fog, one file at a time. (Before I was using heroku, the task saved the files locally and everything worked fine.) When I run the task using heroku run:detached, it runs for a while, and uploads a bunch of files, but eventually fails with Connection reset by peer (Errno::ECONNRESET). What's weird about this is that I've modified the script to catch and retry that exception like so:
file_exists = false
retry_count = 10
begin
file_exists = directory.files.head(filekey)
rescue Errno::ECONNRESET => e
if retry_count > 0 then
logger.warning("Connection reset: #{e.inspect}")
retry_count -= 1
sleep(1)
retry
else
raise
end
end
According to the stack trace, file_exists = directory.files.head(filekey) is the line of my code that leads to the exception, so I feel like I'm missing something about Ruby exception handling. I'd love to know what I'm doing wrong, since I'm not 100% sure if this is a problem with my begin/rescue block, the way fog handles network errors, or what.
Here's the complete stack trace:
Nov 07 12:08:01 ... app/run.1: Connection reset by peer (Errno::ECONNRESET)
Nov 07 12:08:01 ... app/run.1: /app/vendor/ruby-1.8.7/lib/ruby/1.8/openssl/buffering.rb:36:in `sysread'
Nov 07 12:08:01 ... app/run.1: /app/vendor/ruby-1.8.7/lib/ruby/1.8/openssl/buffering.rb:36:in `fill_rbuff'
Nov 07 12:08:01 ... app/run.1: /app/vendor/ruby-1.8.7/lib/ruby/1.8/openssl/buffering.rb:68:in `read'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/socket.rb:121:in `read'
Nov 07 12:08:01 ... app/run.1: /app/vendor/ruby-1.8.7/lib/ruby/1.8/timeout.rb:67:in `timeout'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/socket.rb:120:in `read'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/ssl_socket.rb:79:in `read'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/response.rb:21:in `parse'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/connection.rb:275:in `request_kernel'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/excon-0.16.7/lib/excon/connection.rb:103:in `request'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/fog-1.6.0/lib/fog/core/connection.rb:20:in `request'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/fog-1.6.0/lib/fog/aws/storage.rb:392:in `request'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/fog-1.6.0/lib/fog/aws/requests/storage/head_object.rb:53:in `head_object'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/fog-1.6.0/lib/fog/aws/models/storage/files.rb:98:in `head'
Nov 07 12:08:01 ... app/run.1: /app/lib/tasks/assets.rake:45
Nov 07 12:08:01 ... app/run.1: /app/lib/tasks/assets.rake:37:in `each'
Nov 07 12:08:01 ... app/run.1: /app/lib/tasks/assets.rake:37
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/activerecord-3.1.8/lib/active_record/relation/batches.rb:21:in `find_each'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/activerecord-3.1.8/lib/active_record/relation/batches.rb:21:in `each'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/activerecord-3.1.8/lib/active_record/relation/batches.rb:21:in `find_each'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/activerecord-3.1.8/lib/active_record/relation/batches.rb:69:in `find_in_batches'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/activerecord-3.1.8/lib/active_record/relation/batches.rb:20:in `find_each'
Nov 07 12:08:01 ... app/run.1: /app/lib/tasks/assets.rake:35
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
Nov 07 12:08:01 ... app/run.1: /app/vendor/ruby-1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/bin/rake:33
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/bin/rake:23:in `load'
Nov 07 12:08:01 ... app/run.1: /app/vendor/bundle/ruby/1.8/bin/rake:23
Nov 07 12:08:01 ... app/run.1: Tasks: TOP => ...:make_outlines
Nov 07 12:08:02 ... heroku/run.1: Process exited with status 1
Nov 07 12:08:02 ... heroku/run.1: State changed from up to complete
perhaps try like this:
begin
...
rescue Errno::ECONNRESET => e
...
rescue => e
...
end

Resources