nexus-repository-composer icon indicating copy to clipboard operation
nexus-repository-composer copied to clipboard

Composer2.X: Error rebuilding index for p2 indexes after some package is removed from Nexus

Open s2504s opened this issue 2 years ago • 5 comments

After some package is removed from Nexus composer repo - the search index for v2 is broken (v1 works well) and Nexus trows such message to the logs:

2022-07-01 07:50:00,002+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change WAITING -> RUNNING
2022-07-01 07:50:00,003+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change RUNNING -> WAITING (OK)
2022-07-01 08:00:00,002+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change WAITING -> RUNNING
2022-07-01 08:00:00,003+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] state change RUNNING -> WAITING (OK)
2022-07-01 08:02:54,283+0000 INFO  [qtp1510289817-52133] vstorm org.sonatype.nexus.rapture.internal.security.SessionServlet - Created session for user: vs
2022-07-01 08:03:07,248+0000 INFO  [qtp1510289817-52136] vstorm org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Repair - Rebuild repository search' [repository.rebuild-index] : state=RUNNING
2022-07-01 08:03:07,250+0000 INFO  [qtp1510289817-52136] vstorm org.sonatype.nexus.scheduling.TaskSchedulerImpl - Task 'Repair - Rebuild repository search' [repository.rebuild-index] scheduled: now
2022-07-01 08:03:07,255+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.repository.search.index.RebuildIndexTask - Task log: /nexus-data/log/tasks/repository.rebuild-index-20220701080307254.log
2022-07-01 08:03:07,255+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.repository.content.search.SearchFacetImpl - Rebuilding index of repository composer
2022-07-01 08:03:07,264+0000 INFO  [elasticsearch[62978083-450FCFDD-98896F30-6BF6472C-B7D78C9C][clusterService#updateTask][T#1]] *SYSTEM org.elasticsearch.cluster.metadata - [62978083-450FCFDD-98896F30-6BF6472C-B7D78C9C] [a5fb8d63cbca434631ba8e32c4574085b4419a09] creating index, cause [api], templates [], shards [1]/[0], mappings [component]
2022-07-01 08:03:07,275+0000 ERROR [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.repository.content.search.SearchFacetImpl - Unable to rebuild search index for repository composer
org.sonatype.nexus.repository.MissingFacetException: No facet of type ContentFacet attached to repository composer
	at org.sonatype.nexus.repository.manager.internal.RepositoryImpl.facet(RepositoryImpl.java:322)
	at org.sonatype.nexus.repository.content.search.SearchFacetImpl.rebuildComponentIndex(SearchFacetImpl.java:154)
	at org.sonatype.nexus.repository.content.search.SearchFacetImpl.rebuildIndex(SearchFacetImpl.java:145)
	at org.sonatype.nexus.repository.content.search.SearchFacetImpl$$EnhancerByGuice$$422360829.GUICE$TRAMPOLINE(<generated>)
	at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
	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:54)
	at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
	at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
	at org.sonatype.nexus.repository.content.search.SearchFacetImpl$$EnhancerByGuice$$422360829.rebuildIndex(<generated>)
	at org.sonatype.nexus.repository.search.index.RebuildIndexTask.execute(RebuildIndexTask.java:33)
	at org.sonatype.nexus.repository.RepositoryTaskSupport.execute(RepositoryTaskSupport.java:79)
	at org.sonatype.nexus.scheduling.TaskSupport.call(TaskSupport.java:100)
	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.doExecute(QuartzTaskJob.java:143)
	at org.sonatype.nexus.quartz.internal.task.QuartzTaskJob.execute(QuartzTaskJob.java:106)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.sonatype.nexus.quartz.internal.QuartzThreadPool.lambda$0(QuartzThreadPool.java:145)
	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)
2022-07-01 08:03:07,276+0000 INFO  [quartz-10-thread-19] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Repair - Rebuild repository search' [repository.rebuild-index] state change RUNNING -> OK
2022-07-01 08:03:07,283+0000 INFO  [elasticsearch[62978083-450FCFDD-98896F30-6BF6472C-B7D78C9C][clusterService#updateTask][T#1]] *SYSTEM org.elasticsearch.cluster.routing.allocation - [62978083-450FCFDD-98896F30-6BF6472C-B7D78C9C] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[a5fb8d63cbca434631ba8e32c4574085b4419a09][0]] ...]).

s2504s avatar Jul 01 '22 08:07 s2504s

I have the same issue if the json file is invalid, composer fails. In my case, it happens when I request a nonexistent package neither in nexus nor in packagist.

bcerati avatar Jul 05 '22 14:07 bcerati

Have the same problem :C

ByJacob avatar Oct 12 '22 08:10 ByJacob

In my case, the files for composer2 did not generate correctly and showed deleted packages. I had to manually remove the asset from db and restart nexus. Now the packages index correctly, but the error still remained.

ByJacob avatar Oct 12 '22 10:10 ByJacob

In my case, the files for composer2 did not generate correctly and showed deleted packages. I had to manually remove the asset from db and restart nexus. Now the packages index correctly, but the error still remained.

@ByJacob What steps did you carry out to do this exactly?

ricardoee avatar May 19 '24 18:05 ricardoee

In my case, the files for composer2 did not generate correctly and showed deleted packages. I had to manually remove the asset from db and restart nexus. Now the packages index correctly, but the error still remained.

@ByJacob What steps did you carry out to do this exactly?

Unfortunately, it was so long ago that I don't remember.

ByJacob avatar May 19 '24 19:05 ByJacob