nexus 3.16.1-02 - cleanup task failing

384 views
Skip to first unread message

Frank Black

unread,
Jun 10, 2019, 12:42:51 PM6/10/19
to Nexus Users
Hi All,

I've been setting up multiple cleanup policies recently and I've noticed that the task always fails with the following error. I have 2 jobs, one to clean up maven repos with artifacts older than 180 days and another one to clean up docker images older than 7 days in specific repos.

Any ideas?

java.lang.NullPointerException: null
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:882)
at org.sonatype.nexus.cleanup.internal.storage.orient.OrientCleanupPolicyEntityAdapter.get(OrientCleanupPolicyEntityAdapter.java:133)
at org.sonatype.nexus.cleanup.internal.storage.orient.OrientCleanupPolicyStorage.lambda$3(OrientCleanupPolicyStorage.java:95)
at org.sonatype.nexus.orient.transaction.OrientOperations.lambda$1(OrientOperations.java:56)
at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:56)
at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:200)
at org.sonatype.nexus.transaction.Operations.call(Operations.java:146)
at org.sonatype.nexus.orient.transaction.OrientOperations.call(OrientOperations.java:56)
at org.sonatype.nexus.cleanup.internal.storage.orient.OrientCleanupPolicyStorage.get(OrientCleanupPolicyStorage.java:95)
at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:53)
at org.sonatype.nexus.cleanup.internal.service.CleanupServiceImpl.findPolicy(CleanupServiceImpl.java:144)
at org.sonatype.nexus.cleanup.internal.service.CleanupServiceImpl.cleanup(CleanupServiceImpl.java:98)
at org.sonatype.nexus.cleanup.internal.service.CleanupServiceImpl.lambda$0(CleanupServiceImpl.java:88)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:407)
at org.sonatype.nexus.cleanup.internal.service.CleanupServiceImpl.cleanup(CleanupServiceImpl.java:86)
at org.sonatype.nexus.cleanup.internal.task.CleanupTask.execute(CleanupTask.java:46)
at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:145)
at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:108)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.sonatype.nexus.quartz.internal.QuartzThreadPool.lambda$0(QuartzThreadPool.java:143)
at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40)
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-06-10 09:30:32,188-0700 INFO  [quartz-3-thread-18]  *SYSTEM org.sonatype.nexus.cleanup.internal.task.CleanupTask - Task complete

Thanks,

Rich Seddon

unread,
Jun 10, 2019, 12:48:52 PM6/10/19
to Nexus Users

There is a bug open for this, as I recall.

This can happen if there is a cleanup policy defined on a repository, and the policy does not exist anymore. Can you check for that?


Rich

Frank Black

unread,
Jun 10, 2019, 1:20:33 PM6/10/19
to Nexus Users
Thanks Rich.
I checked all my repos and they were all either set to empty or were assigned an existing cleanup policy. Either way, I unassigned the policies for all the ones that had one, saved, then re-assigned the policies. I'm still getting the error. Anything else I should try?


FYI: we just noticed that the cleanup policy for maven doesn't take into account if a component was never downloaded. Was there a feature request put in to allow to delete components that were never downloaded and are older than, say, X days?

Thanks,

Peter Lynch

unread,
Jun 10, 2019, 2:13:36 PM6/10/19
to Frank Black, Nexus Users
On Mon, Jun 10, 2019 at 2:20 PM Frank Black <undec...@gmail.com> wrote:
Thanks Rich.
I checked all my repos and they were all either set to empty or were assigned an existing cleanup policy. Either way, I unassigned the policies for all the ones that had one, saved, then re-assigned the policies. I'm still getting the error. Anything else I should try?


FYI: we just noticed that the cleanup policy for maven doesn't take into account if a component was never downloaded. Was there a feature request put in to allow to delete components that were never downloaded and are older than, say, X days?

See https://issues.sonatype.org/browse/NEXUS-19424 - Add ability to cleanup by "Never downloaded"
 
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/1dc6556c-5c2d-4ec3-aa6f-a8a8db3d2996%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.


--
Sonatype
Peter Lynch
Senior Product Support Engineer

Andrew Cobaugh

unread,
Sep 10, 2019, 3:05:57 PM9/10/19
to Nexus Users
Was there ever a solution to this? Seeing the exact same thing Frank was seeing. My repository cleanup policies are either set to None or set to a valid cleanup policy name. Running 3.18.0-01. Specifically, we're trying to cleanup docker tags older than X days (would prefer deleting all tags and keeping X most recent... if anyone has a Groovy script or such that does that...).

Frank Black

unread,
Sep 11, 2019, 11:25:05 AM9/11/19
to Nexus Users
I could not figure out how to clean up docker tags / images older than X days. We tried scripting it using groovy too, but we end up messing up layers and breaking other images too. If you ever come up with a decent solution, let me know.

Andrew Cobaugh

unread,
Sep 11, 2019, 11:38:14 AM9/11/19
to Frank Black, Nexus Users
I ended up using nexus-cli (https://github.com/mlabouardy/nexus-cli) and just scripted around that. We're in the process of migrating our image repositories to quay.io, so hopefully we'll only have to run this script a few more times between now and then to keep the nexus blob store from exploding.

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.


--
andy
Reply all
Reply to author
Forward
0 new messages