Study/CI&CD

[troubleshooting] sonatype nexus BufferUnderflowException 발생

Bluesky_ 2022. 2. 21. 18:54
반응형

개인적으로 로컬에  sonatype nexus3를 로컬에 두고 사용하고 있었다.

그런데 어느 날 다음과 같은 에러가 발생하면서 k8s에 올려둔 nexus pod가 무한 restart를 하였다.

2022-02-21 09:03:26,721+0000 ERROR [FelixStartLevel <query>SELECT FROM quartz_trigger WHERE name = ? AND group = ?</query>] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage - Exception `742BDBBA` in storage `plocal:/nexus-data/db/config`: 2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x)
java.nio.BufferUnderflowException: null
        at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:270)
        at java.nio.ByteBuffer.get(ByteBuffer.java:723)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurablePage.getBinaryValue(ODurablePage.java:140)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OClusterPage.getRecordBinaryValue(OClusterPage.java:386)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readFullEntry(OPaginatedCluster.java:1910)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecordBuffer(OPaginatedCluster.java:779)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecord(OPaginatedCluster.java:742)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecord(OPaginatedCluster.java:721)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doReadRecord(OAbstractPaginatedStorage.java:4220)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:3807)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:1410)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx$SimpleRecordReader.readRecord(ODatabaseDocumentTx.java:3395)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeReadRecord(ODatabaseDocumentTx.java:2008)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:656)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:103)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearchRecord(OCommandExecutorSQLSelect.java:585)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.serialIterator(OCommandExecutorSQLSelect.java:1638)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.fetchFromTarget(OCommandExecutorSQLSelect.java:1585)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.fetchValuesFromIndexCursor(OCommandExecutorSQLSelect.java:2466)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchForIndexes(OCommandExecutorSQLSelect.java:2280)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:1017)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:203)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:527)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:509)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:485)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:70)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3400)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3318)
        at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:78)
        at com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery.run(OSQLAsynchQuery.java:74)
        at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:102)
        at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
        at org.sonatype.nexus.quartz.internal.orient.ReadEntityByKeyAction.execute(ReadEntityByKeyAction.java:60)
        at org.sonatype.nexus.quartz.internal.orient.TriggerEntityAdapter.readByKey(TriggerEntityAdapter.java:203)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.lambda$23(JobStoreImpl.java:702)
        at org.sonatype.nexus.orient.transaction.OrientOperations.lambda$1(OrientOperations.java:55)
        at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
        at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:58)
        at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
        at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:223)
        at org.sonatype.nexus.transaction.Operations.call(Operations.java:166)
        at org.sonatype.nexus.orient.transaction.OrientOperations.call(OrientOperations.java:55)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.executeRead(JobStoreImpl.java:203)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.retrieveTrigger(JobStoreImpl.java:701)
        at org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1505)
        at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.getNexusJobs(QuartzSchedulerSPI.java:762)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.forEachNexusJob(QuartzSchedulerSPI.java:233)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.reattachListeners(QuartzSchedulerSPI.java:197)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.doStart(QuartzSchedulerSPI.java:192)
        at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI$$EnhancerByGuice$$350473869.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$TransitionImpl.run(StateGuard.java:193)
        at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
        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.quartz.internal.QuartzSchedulerSPI$$EnhancerByGuice$$350473869.start(<generated>)
        at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
        at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
        at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
        at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
        at java.lang.Thread.run(Thread.java:748)
2022-02-21 09:03:26,723+0000 ERROR [FelixStartLevel <query>SELECT FROM quartz_trigger WHERE name = ? AND group = ?</query>] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage - Exception `191FBBC2` in storage `plocal:/nexus-data/db/config`: 2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x)
com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #30:1 (cluster: quartz_trigger)
        DB name="config"
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeReadRecord(ODatabaseDocumentTx.java:2046)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:656)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:103)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearchRecord(OCommandExecutorSQLSelect.java:585)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.serialIterator(OCommandExecutorSQLSelect.java:1638)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.fetchFromTarget(OCommandExecutorSQLSelect.java:1585)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.fetchValuesFromIndexCursor(OCommandExecutorSQLSelect.java:2466)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchForIndexes(OCommandExecutorSQLSelect.java:2280)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:1017)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:203)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:527)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:509)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:485)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:70)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3400)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3318)
        at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:78)
        at com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery.run(OSQLAsynchQuery.java:74)
        at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:102)
        at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
        at org.sonatype.nexus.quartz.internal.orient.ReadEntityByKeyAction.execute(ReadEntityByKeyAction.java:60)
        at org.sonatype.nexus.quartz.internal.orient.TriggerEntityAdapter.readByKey(TriggerEntityAdapter.java:203)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.lambda$23(JobStoreImpl.java:702)
        at org.sonatype.nexus.orient.transaction.OrientOperations.lambda$1(OrientOperations.java:55)
        at org.sonatype.nexus.transaction.OperationPoint.proceed(OperationPoint.java:64)
        at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:58)
        at org.sonatype.nexus.transaction.Operations.proceedWithTransaction(Operations.java:232)
        at org.sonatype.nexus.transaction.Operations.transactional(Operations.java:223)
        at org.sonatype.nexus.transaction.Operations.call(Operations.java:166)
        at org.sonatype.nexus.orient.transaction.OrientOperations.call(OrientOperations.java:55)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.executeRead(JobStoreImpl.java:203)
        at org.sonatype.nexus.quartz.internal.orient.JobStoreImpl.retrieveTrigger(JobStoreImpl.java:701)
        at org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1505)
        at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.getNexusJobs(QuartzSchedulerSPI.java:762)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.forEachNexusJob(QuartzSchedulerSPI.java:233)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.reattachListeners(QuartzSchedulerSPI.java:197)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI.doStart(QuartzSchedulerSPI.java:192)
        at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
        at org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI$$EnhancerByGuice$$350473869.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$TransitionImpl.run(StateGuard.java:193)
        at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
        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.quartz.internal.QuartzSchedulerSPI$$EnhancerByGuice$$350473869.start(<generated>)
        at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
        at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
        at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
        at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.BufferUnderflowException: null
        at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:270)
        at java.nio.ByteBuffer.get(ByteBuffer.java:723)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurablePage.getBinaryValue(ODurablePage.java:140)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OClusterPage.getRecordBinaryValue(OClusterPage.java:386)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readFullEntry(OPaginatedCluster.java:1910)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecordBuffer(OPaginatedCluster.java:779)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecord(OPaginatedCluster.java:742)
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.readRecord(OPaginatedCluster.java:721)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doReadRecord(OAbstractPaginatedStorage.java:4220)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:3807)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:1410)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx$SimpleRecordReader.readRecord(ODatabaseDocumentTx.java:3395)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeReadRecord(ODatabaseDocumentTx.java:2008)
        ... 53 common frames omitted

구글링 해보니 /nexus-data/db/config가 아닌 /nexus-data/db/component 에서 에러가 발생하는 경우가 많은가 보다.

아무래도 개인 pc에 사용하다 보니 계속 pc가 구동되는 상태도 아니어서 그런지 충돌이 발생한 듯하다.

복구를 하는 방법을 찾아보니 방법이 다음과 같이 안내되어 있었다.

https://issues.sonatype.org/browse/NEXUS-18036

  1. Shut down Nexus
  2. Make a backup of /nexus-data/db
  3. Run: java -jar $INSTALL_DIR/lib/support/nexus-orient-console.jar
  4. At the orientdb prompt run the following:
connect plocal:/nexus-data/db/component/ admin admin 
repair database --fix-links 
rebuild index * 
disconnect
exit

하지만 window에서 k8s에 띄운 pod 내 에러이다 보니 진입이 되지 않기 때문에 다른 방법을 찾아보았다.

심플하면서 단순한 방법인데 nexus pod를 내리고 /nexus-data/db 폴더를 지워버리고 다시 띄우면 된다.

다만 이 경우 nexus를 처음 설치했던 비밀번호 초기화 단계부터 다시 진행해야 하고 저장된 설정도 모두 날아가고 repository도 날아간다.

복구의 의미가 무색하긴 하지만 개인적으로 사용하면서 이런 오류로 인해 nexus를 사용하지 못하는 경우 이렇게 하면 서버를 다시 띄울 수 있다.

반응형