Skip to content

Handling the last QOTW submission results in exception due to archived thread #538

Description

@danthe1st
  1. Describe the bug
    When reviewing QOTW the last QOTW submission, the review thread is archived and locked in two steps. This can lead to the following exception:
ForkJoinPool.commonPool-worker-667            RestAction      ERROR  RestAction queue returned failure
net.dv8tion.jda.api.exceptions.ErrorResponseException: 50083: Thread is archived
        at net.dv8tion.jda.api.requests.Request.createErrorResponseException(Request.java:156)
        at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:297)
        at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:290)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.handleResponse(Requester.java:413)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.access$300(Requester.java:360)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:241)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:156)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:140)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.execute(Requester.java:383)
        at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.execute(SequentialRestRateLimiter.java:468)
        at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.run(SequentialRestRateLimiter.java:514)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
        at java.base@25.0.2/java.lang.Thread.runWith(Thread.java:1487)
        at java.base@25.0.2/java.lang.Thread.run(Thread.java:1474)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
Caused by: net.dv8tion.jda.api.exceptions.ContextException
        at net.dv8tion.jda.api.requests.Request.<init>(Request.java:85)
        at net.dv8tion.jda.internal.requests.RestActionImpl.queue(RestActionImpl.java:199)
        at net.dv8tion.jda.internal.managers.ManagerBase.queue(ManagerBase.java:113)
        at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:549)
        at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:516)
        at net.discordjug.javabot.systems.qotw.submissions.SubmissionManager.lambda$handleSelectReview$2(SubmissionManager.java:150)
        at net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:131)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
        at java.base@25.0.2/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
        at java.base@25.0.2/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
        at java.base@25.0.2/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
        ... 2 common frames omitted
  1. Steps to reproduce
  • Configure the bot for QOTW
  • Add a new QOTW question
  • Start the QOTW
  • Answer the QOTW
  • Close the QOTW
  • Review the QOTW (should be the last one).
  1. Expected behavior
    The channel should be archived and locked without an exception.

  2. Additional context

    reviewChannel.asThreadChannel().getManager().setArchived(true).queue();

    channel.asThreadChannel().getManager().setLocked(true).queue();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions