java.util.NoSuchElementException: null

Atlassian JIRA | Pierre-Etienne Poirot [Atlassian] | 2 years ago
  1. 0

    Since 3.2, Stash by default delays the deletion of any user by a week to be resilient to transient deletions (see STASH-4631 for more details). This is internally performed by a background job, {{UserCleanupJob}}, that executes (again by default) every 6 hours. As part of this job, Stash fetches the users that were deleted in a [User Directory|https://confluence.atlassian.com/display/STASH032/External+user+directories] a week or more ago. Then for each user, it marks them as deleted. (Stash cannot fully delete an user in the database because it needs to preserve the user's pull requests, comments, etc. However the user will no longer have access to Stash). The problem with the current implementation of {{UserCleanupJob}} is that it currently fetches the users (by batch of 100) and update them within the same transaction. As a result, if there is more 100 users, an error is thrown and as a result the transaction is rollback: {noformat} 2014-11-28 09:39:33,051 ERROR [clusterScheduler_Worker-1] c.a.scheduler.core.JobLauncher Scheduled job with ID 'UserCleanupJob' failed java.util.NoSuchElementException: null at com.google.common.collect.Iterators$9.next(Iterators.java:966) ~[guava-11.0.2-atlassian-01.jar:na] at com.atlassian.stash.util.PagedIterable$PagedIterator.next(PagedIterable.java:48) ~[stash-util-3.2.7.jar:na] at com.atlassian.stash.internal.user.DefaultUserAdminService$3.doInTransactionWithoutResult(DefaultUserAdminService.java:620) ~[stash-service-impl-3.2.7.jar:na] at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) ~[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at com.atlassian.stash.internal.user.DefaultUserAdminService.cleanupDeletedUsers(DefaultUserAdminService.java:608) ~[stash-service-impl-3.2.7.jar:na] at com.atlassian.stash.internal.user.DefaultUserAdminService$UserCleanupJob.runJob(DefaultUserAdminService.java:648) ~[stash-service-impl-3.2.7.jar:na] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:127) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) [atlassian-scheduler-quartz1-1.2.2.jar:na] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:na] {noformat}

    Atlassian JIRA | 2 years ago | Pierre-Etienne Poirot [Atlassian]
    java.util.NoSuchElementException: null
  2. 0

    Since 3.2, Stash by default delays the deletion of any user by a week to be resilient to transient deletions (see STASH-4631 for more details). This is internally performed by a background job, {{UserCleanupJob}}, that executes (again by default) every 6 hours. As part of this job, Stash fetches the users that were deleted in a [User Directory|https://confluence.atlassian.com/display/STASH032/External+user+directories] a week or more ago. Then for each user, it marks them as deleted. (Stash cannot fully delete an user in the database because it needs to preserve the user's pull requests, comments, etc. However the user will no longer have access to Stash). The problem with the current implementation of {{UserCleanupJob}} is that it currently fetches the users (by batch of 100) and update them within the same transaction. As a result, if there is more 100 users, an error is thrown and as a result the transaction is rollback: {noformat} 2014-11-28 09:39:33,051 ERROR [clusterScheduler_Worker-1] c.a.scheduler.core.JobLauncher Scheduled job with ID 'UserCleanupJob' failed java.util.NoSuchElementException: null at com.google.common.collect.Iterators$9.next(Iterators.java:966) ~[guava-11.0.2-atlassian-01.jar:na] at com.atlassian.stash.util.PagedIterable$PagedIterator.next(PagedIterable.java:48) ~[stash-util-3.2.7.jar:na] at com.atlassian.stash.internal.user.DefaultUserAdminService$3.doInTransactionWithoutResult(DefaultUserAdminService.java:620) ~[stash-service-impl-3.2.7.jar:na] at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) ~[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at com.atlassian.stash.internal.user.DefaultUserAdminService.cleanupDeletedUsers(DefaultUserAdminService.java:608) ~[stash-service-impl-3.2.7.jar:na] at com.atlassian.stash.internal.user.DefaultUserAdminService$UserCleanupJob.runJob(DefaultUserAdminService.java:648) ~[stash-service-impl-3.2.7.jar:na] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:127) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) [atlassian-scheduler-core-1.2.2.jar:na] at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) [atlassian-scheduler-quartz1-1.2.2.jar:na] at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:na] {noformat}

    Atlassian JIRA | 2 years ago | Pierre-Etienne Poirot [Atlassian]
    java.util.NoSuchElementException: null
  3. 0
    Check if the field you try to read really exists in the database. If it is optional, just use com.mongodb.casbah.commons.MongoDBObject#getAs
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I have discovered the following exception from a scheduler that is running off master with the beta task store enabled. {noformat} E0113 22:51:55.941 [AsyncProcessor-2, AsyncUtil:123] java.util.concurrent.ExecutionException: java.util.NoSuchElementException java.util.concurrent.ExecutionException: java.util.NoSuchElementException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_66-Tw8r9b1] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_66-Tw8r9b1] at org.apache.aurora.scheduler.base.AsyncUtil.evaluateResult(AsyncUtil.java:118) [aurora-110.jar:na] at org.apache.aurora.scheduler.base.AsyncUtil.access$000(AsyncUtil.java:32) [aurora-110.jar:na] at org.apache.aurora.scheduler.base.AsyncUtil$1.afterExecute(AsyncUtil.java:59) [aurora-110.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1150) [na:1.8.0_66-Tw8r9b1] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66-Tw8r9b1] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66-Tw8r9b1] Caused by: java.util.NoSuchElementException: null at com.google.common.collect.Iterables.getLast(Iterables.java:784) ~[guava-19.0.jar:na] at org.apache.aurora.scheduler.base.Tasks.getLatestEvent(Tasks.java:149) ~[aurora-110.jar:na] at org.apache.aurora.scheduler.base.Tasks$1.apply(Tasks.java:156) ~[aurora-110.jar:na] at org.apache.aurora.scheduler.base.Tasks$1.apply(Tasks.java:153) ~[aurora-110.jar:na] at com.google.common.collect.ByFunctionOrdering.compare(ByFunctionOrdering.java:45) ~[guava-19.0.jar:na] at java.util.TimSort.binarySort(TimSort.java:296) ~[na:1.8.0_66-Tw8r9b1] at java.util.TimSort.sort(TimSort.java:239) ~[na:1.8.0_66-Tw8r9b1] at java.util.Arrays.sort(Arrays.java:1438) ~[na:1.8.0_66-Tw8r9b1] at com.google.common.collect.Ordering.sortedCopy(Ordering.java:860) ~[guava-19.0.jar:na] at org.apache.aurora.scheduler.pruning.TaskHistoryPruner.lambda$registerInactiveTask$20(TaskHistoryPruner.java:156) ~[aurora-110.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_66-Tw8r9b1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_66-Tw8r9b1] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_66-Tw8r9b1] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_66-Tw8r9b1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66-Tw8r9b1] ... 2 common frames omitted {noformat} Similar exception occurs within the preemptor and causes the scheduler to crash: {noformat} E0113 01:43:06.242 THREAD5037 com.google.common.util.concurrent.ServiceManager$ServiceListener.failed: Service PreemptorService [FAILED] has failed in the RUNNING state. java.util.NoSuchElementException at com.google.common.collect.Iterables.getLast(Iterables.java:784) at org.apache.aurora.scheduler.base.Tasks.getLatestEvent(Tasks.java:149) at org.apache.aurora.scheduler.preemptor.PendingTaskProcessor$3.apply(PendingTaskProcessor.java:237) at org.apache.aurora.scheduler.preemptor.PendingTaskProcessor$3.apply(PendingTaskProcessor.java:234) at com.google.common.base.Predicates$AndPredicate.apply(Predicates.java:374) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:675) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.TransformedIterator.hasNext(TransformedIterator.java:43) at com.google.common.collect.Iterators.addAll(Iterators.java:364) at com.google.common.collect.Iterables.addAll(Iterables.java:352) at com.google.common.collect.HashMultiset.create(HashMultiset.java:66) at org.apache.aurora.scheduler.preemptor.PendingTaskProcessor.fetchIdlePendingGroups(PendingTaskProcessor.java:183) at org.apache.aurora.scheduler.preemptor.PendingTaskProcessor.lambda$run$140(PendingTaskProcessor.java:144) at org.apache.aurora.scheduler.storage.db.DbStorage.read(DbStorage.java:138) at org.mybatis.guice.transactional.TransactionalMethodInterceptor.invoke(TransactionalMethodInterceptor.java:101) at org.apache.aurora.common.inject.TimedInterceptor.invoke(TimedInterceptor.java:83) at org.apache.aurora.scheduler.storage.log.LogStorage.read(LogStorage.java:570) at org.apache.aurora.scheduler.storage.CallOrderEnforcingStorage.read(CallOrderEnforcingStorage.java:113) at org.apache.aurora.scheduler.preemptor.PendingTaskProcessor.run(PendingTaskProcessor.java:119) at org.apache.aurora.scheduler.preemptor.PreemptorModule$PreemptorService.runOneIteration(PreemptorModule.java:145) at com.google.common.util.concurrent.AbstractScheduledService$ServiceDelegate$Task.run(AbstractScheduledService.java:189) at com.google.common.util.concurrent.Callables$3.run(Callables.java:100) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {noformat} Background: I discovered this while running a load test on a small test cluster. This exception kept on occurring, preventing any tasks from being pruned from the dbtask store. This exception also kept on killing the preemptor, causing a new scheduler to be elected. Eventually the number of tasks stored for this job reached 8k+ and there was a general slowdown observed across the entire system. After a certain point, the scheduler wasn't able to register within the 1minute registration timeout, causing the entire cluster to stop working until I raised the timeout to 5 minutes, and then killed the job preventing more tasks from being created.

    Apache's JIRA Issue Tracker | 1 year ago | Zameer Manji
    java.util.concurrent.ExecutionException: java.util.NoSuchElementException java.util.concurrent.ExecutionException: java.util.NoSuchElementException
  6. 0

    LrEntity with no IDs - deobfuscate exceptions

    GitHub | 10 months ago | andrus
    java.util.NoSuchElementException: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.NoSuchElementException

      null

      at com.google.common.collect.Iterators$9.next()
    2. Guava
      Iterators$9.next
      1. com.google.common.collect.Iterators$9.next(Iterators.java:966)[guava-11.0.2-atlassian-01.jar:na]
      1 frame
    3. com.atlassian.stash
      DefaultUserAdminService$3.doInTransactionWithoutResult
      1. com.atlassian.stash.util.PagedIterable$PagedIterator.next(PagedIterable.java:48)[stash-util-3.2.7.jar:na]
      2. com.atlassian.stash.internal.user.DefaultUserAdminService$3.doInTransactionWithoutResult(DefaultUserAdminService.java:620)[stash-service-impl-3.2.7.jar:na]
      2 frames
    4. Spring Tx
      TransactionTemplate.execute
      1. org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE]
      2. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE]
      2 frames
    5. com.atlassian.stash
      DefaultUserAdminService$UserCleanupJob.runJob
      1. com.atlassian.stash.internal.user.DefaultUserAdminService.cleanupDeletedUsers(DefaultUserAdminService.java:608)[stash-service-impl-3.2.7.jar:na]
      2. com.atlassian.stash.internal.user.DefaultUserAdminService$UserCleanupJob.runJob(DefaultUserAdminService.java:648)[stash-service-impl-3.2.7.jar:na]
      2 frames
    6. com.atlassian.scheduler
      Quartz1Job.execute
      1. com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:127)[atlassian-scheduler-core-1.2.2.jar:na]
      2. com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)[atlassian-scheduler-core-1.2.2.jar:na]
      3. com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)[atlassian-scheduler-core-1.2.2.jar:na]
      4. com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)[atlassian-scheduler-quartz1-1.2.2.jar:na]
      4 frames
    7. quartz
      SimpleThreadPool$WorkerThread.run
      1. org.quartz.core.JobRunShell.run(JobRunShell.java:223)[quartz-1.8.6.jar:na]
      2. org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.6.jar:na]
      2 frames