Over the weekend, I installed a completely new instance of Rundeck 4.9.0 based on Docker and a Postgres database based on Docker in the same docker-stack.yml file.
I sometimes get a Null Pointer Exception when a job tries
to run. We have around 100 jobs and only 15 of them fail intermittently
and it only happens on 30% of executions of those 15 jobs. Here is
the stacktrack:
[2023-02-11T17:05:02,268] ERROR services.ExecutionService - Failed while starting execution: 2779
java.lang.NullPointerException: null
at
org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:301)
~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
at
org.grails.orm.hibernate.GrailsHibernateTemplate.get(GrailsHibernateTemplate.java:364)
~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
at
org.grails.orm.hibernate.AbstractHibernateGormStaticApi.get(AbstractHibernateGormStaticApi.groovy:120)
~[grails-datastore-gorm-hibernate5-7.2.2.jar!/:?]
at org.grails.datastore.gorm.GormEntity$Trait$Helper.get(GormEntity.groovy:553) ~[grails-datastore-gorm-7.2.1.jar!/:?]
at org.grails.datastore.gorm.GormEntity$Trait$Helper$get$6.call(Unknown Source) ~[?:?]
at rundeck.ScheduledExecution.get(ScheduledExecution.groovy) ~[classes!/:?]
at rundeck.ScheduledExecution$get$11.call(Unknown Source) ~[?:?]
at
rundeck.services.NotificationService$__tt__asyncTriggerJobNotification_closure21.doCall(NotificationService.groovy:197)
~[classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) ~[groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:412) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:428) ~[groovy-3.0.9.jar!/:3.0.9]
at
grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
~[grails-datastore-gorm-7.2.1.jar!/:?]
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
~[spring-tx-5.3.20.jar!/:5.3.20]
at
grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
~[grails-datastore-gorm-7.2.1.jar!/:?]
at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:1014) ~[grails-datastore-gorm-7.2.1.jar!/:?]
at org.grails.datastore.gorm.GormStaticApi.withTransaction(GormStaticApi.groovy:966) ~[grails-datastore-gorm-7.2.1.jar!/:?]
at org.grails.datastore.gorm.GormStaticApi.withNewTransaction(GormStaticApi.groovy:927) ~[grails-datastore-gorm-7.2.1.jar!/:?]
at
org.grails.datastore.gorm.GormEntity$Trait$Helper.withNewTransaction(GormEntity.groovy:954)
~[grails-datastore-gorm-7.2.1.jar!/:?]
at org.grails.datastore.gorm.GormEntity$Trait$Helper$withNewTransaction$7.call(Unknown Source) ~[?:?]
at rundeck.ScheduledExecution.withNewTransaction(ScheduledExecution.groovy) ~[classes!/:?]
at rundeck.ScheduledExecution$withNewTransaction$12.call(Unknown Source) ~[?:?]
at rundeck.services.NotificationService.$tt__asyncTriggerJobNotification(NotificationService.groovy:196) ~[classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1268) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) ~[groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:1029) ~[groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:1012) ~[groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(InvokerHelper.java:101) ~[groovy-3.0.9.jar!/:3.0.9]
at rundeck.services.NotificationService$_asyncTriggerJobNotification_closure6.doCall(NotificationService.groovy) ~[classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) ~[groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:412) ~[groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:428) ~[groovy-3.0.9.jar!/:3.0.9]
at
grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
~[grails-datastore-gorm-7.2.1.jar!/:?]
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
~[spring-tx-5.3.20.jar!/:5.3.20]
at
grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
~[grails-datastore-gorm-7.2.1.jar!/:?]
at rundeck.services.NotificationService.asyncTriggerJobNotification(NotificationService.groovy) ~[classes!/:?]
at rundeck.services.NotificationService$asyncTriggerJobNotification.call(Unknown Source) ~[?:?]
at rundeck.services.ExecutionService.$tt__executeAsyncBegin(ExecutionService.groovy:1195) [classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1268) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:1029) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:1012) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(InvokerHelper.java:101) [groovy-3.0.9.jar!/:3.0.9]
at rundeck.services.ExecutionService$_executeAsyncBegin_closure22.doCall(ExecutionService.groovy) [classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:412) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:428) [groovy-3.0.9.jar!/:3.0.9]
at
grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
[grails-datastore-gorm-7.2.1.jar!/:?]
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
[spring-tx-5.3.20.jar!/:5.3.20]
at
grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
[grails-datastore-gorm-7.2.1.jar!/:?]
at rundeck.services.ExecutionService.executeAsyncBegin(ExecutionService.groovy) [classes!/:?]
at rundeck.quartzjobs.ExecutionJob.executeCommand(ExecutionJob.groovy:370) [classes!/:?]
at rundeck.quartzjobs.ExecutionJob$executeCommand$2.callCurrent(Unknown Source) [classes!/:?]
at rundeck.quartzjobs.ExecutionJob.execute_internal(ExecutionJob.groovy:155) [classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:362) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185) [groovy-3.0.9.jar!/:3.0.9]
at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy:100) [classes!/:?]
at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy) [classes!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:412) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.call(Closure.java:406) [groovy-3.0.9.jar!/:3.0.9]
at groovy.lang.Closure.run(Closure.java:493) [groovy-3.0.9.jar!/:3.0.9]
at com.codahale.metrics.Timer.time(Timer.java:151) [metrics-core-4.2.9.jar!/:4.2.9]
at com.codahale.metrics.Timer$time$4.call(Unknown Source) [metrics-core-4.2.9.jar!/:?]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-3.0.9.jar!/:3.0.9]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) [groovy-3.0.9.jar!/:3.0.9]
at rundeck.quartzjobs.ExecutionJob.execute(ExecutionJob.groovy:99) [classes!/:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.2.jar!/:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.2.jar!/:?]
Dockerfile:
FROM rundeck/rundeck:4.8.0
RUN mkdir /home/rundeck/machine-nodes/
RUN cat /home/rundeck/docker-lib/entry.sh | grep '\-Dloginmodule.conf.name=jaas-loginmodule.conf' \
&& sed -i "s/-Dloginmodule.conf.name=jaas-loginmodule.conf/-Dloginmodule.conf.name=jaas-ldap.conf/" /home/rundeck/docker-lib/entry.sh
RUN cat /etc/remco/templates/rundeck-config.properties | grep 'rundeck.api.tokens.duration.max={{ getv("/rundeck/api/tokens/duration/max", "30d") }}'
RUN sed -i "s/rundeck.api.tokens.duration.max={{ getv(\"\/rundeck\/api\/tokens\/duration\/max\", \"30d\") }}/rundeck.api.tokens.duration.max={{ getv(\"\/rundeck\/api\/tokens\/duration\/max\", \"0\") }}/" /etc/remco/templates/rundeck-config.properties
COPY --chown=rundeck:root remco /etc/remco
Docker stack file:
version: '3.8'
networks:
swarm-network:
external: true
volumes:
rundeck-pg-data:
external: true
services:
postgres:
image: postgres
networks:
- swarm-network
volumes:
- rundeck-pg-data:/var/lib/postgresql/data
environment:
- POSTGRES_DATABASE=rundeck
- POSTGRES_USER=rundeck
- POSTGRES_PASSWORD=${RUNDECK_POSTGRES_PASSWORD}
- POSTGRES_ROOT_PASSWORD=${RUNDECK_POSTGRES_ROOT_PASSWORD}
rundeck:
image: ${IMAGE}
networks:
- swarm-network
environment:
- TZ=US/Central
- RUNDECK_GRAILS_URL=https://${SERVICE_DOMAIN}
- RUNDECK_SERVER_FORWARDED=true
- RUNDECK_MAIL_SMTP_HOST=${SMTP_HOST}
- RUNDECK_MAIL_SMTP_PORT=25
- RUNDECK_MAIL_FROM=run...@rundeck.climatecontrolgroup.com
- RUNDECK_DATABASE_URL=jdbc:postgresql://postgres/rundeck
- RUNDECK_DATABASE_DRIVER=org.postgresql.Driver
- RUNDECK_DATABASE_USERNAME=rundeck
- RUNDECK_DATABASE_PASSWORD=${RUNDECK_POSTGRES_PASSWORD}
- EXECUTION_MODE=${EXECUTION_MODE}
- RUNDECK_SA_PASSWORD=${RUNDECK_SA_PASSWORD}
volumes:
- ./conf/realm.properties:/home/rundeck/server/config/realm.properties
- ./conf/admin.aclpolicy:/home/rundeck/etc/admin.aclpolicy
- ./conf/apitoken.aclpolicy:/home/rundeck/etc/apitoken.aclpolicy
- ./conf/CLM-scart-image-upload.aclpolicy:/home/rundeck/etc/CLM-scart-image-upload.aclpolicy
- ./machine-nodes/scheduledjobs-resources.xml:/home/rundeck/machine-nodes/scheduledjobs-resources.xml
- ./machine-nodes/dockerbackups-resources.xml:/home/rundeck/machine-nodes/dockerbackups-resources.xml
- ./machine-nodes/dockercleanup-resources.xml:/home/rundeck/machine-nodes/dockercleanup-resources.xml