java.util.NoSuchElementException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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}
    via by Pierre-Etienne Poirot [Atlassian],
  • 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}
    via by Pierre-Etienne Poirot [Atlassian],
    • 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]
    No Bugmate found.