Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create-interaction-response! blocks after a few consecutive calls #125

Open
Avetixz opened this issue May 20, 2023 · 2 comments
Open

create-interaction-response! blocks after a few consecutive calls #125

Avetixz opened this issue May 20, 2023 · 2 comments
Labels
bug report Reported, but unconfirmed bugs. bug cannot reproduce Bugs that have been tested but can't be found

Comments

@Avetixz
Copy link

Avetixz commented May 20, 2023

Describe the bug
I'm calling discljord.messaging/create-interaction-response! in response to a button being clicked and after around 4 clicks, this function blocks and interactions become very slow. The bot then displays "This interaction failed".
image

If I don't use discljord's create-interaction-response! function for this and instead just send a plain HTTP request, this same problem doesn't occur.

Version Information

  • Clojure Version: 1.10.1
  • Discljord Version: 1.3.1
  • OS bot is hosted on: Arch Linux

To Reproduce
Using my minimal reproduction case:

  1. Use the /open command to make the bot create a message with a button
  2. Press the button a few times
  3. The bot will stop responding

Minimal reproduction case:
https://github.com/Avetixz/minimal-tournament-bot

Expected behavior
The bot should not block so quickly after just a few interactions.

Additional context
In my minimal reproduction case, I wrote a private function create-interaction-response! which sends a plain HTTP request. If you replace discord-rest/create-interaction-response! with create-interaction-response! in line 66, you'll see that the same problem doesn't occur.

@Avetixz Avetixz added the bug report Reported, but unconfirmed bugs. label May 20, 2023
@JohnnyJayJay
Copy link
Member

I set up a small test myself on the latest develop changes, I didn't get this problem. I also tried your exact reproduction case (thank you very much for providing that, btw!). I could not reproduce the issue – I can press the button as soon as it comes up without issues.

Would you mind enabling trace logging for discljord.messaging.impl and sharing the log output (make sure to redact the bot token)? You can do this via the following logback.xml configuration (with logback-classic), for example:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>

<configuration scan="true" scanPeriod="15 seconds">
  <import class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"/>
  <import class="ch.qos.logback.core.ConsoleAppender"/>

  <appender name="STDOUT" class="ConsoleAppender">
    <encoder class="PatternLayoutEncoder">
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="discljord.messaging.impl" level="trace" />
  <root level="info">
    <appender-ref ref="STDOUT"/>
  </root>
</configuration>

Hopefully we get more insights that way.

@JohnnyJayJay JohnnyJayJay added bug cannot reproduce Bugs that have been tested but can't be found labels May 30, 2023
@JohnnyJayJay
Copy link
Member

JohnnyJayJay commented Aug 23, 2023

Getting back to this rather late, but I have a growing suspicion that this is a system clock issue. I experienced something very similar yesterday and the cause ended up being that my NTP service (on Linux) didn't use a remote server to sync the system clock, so the rate limiter ended up computing incorrect reset times.

It's just speculation without a closer look at the trace logs, but it's an obscure enough cause that barely anyone else will catch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Reported, but unconfirmed bugs. bug cannot reproduce Bugs that have been tested but can't be found
Projects
None yet
Development

No branches or pull requests

2 participants