dsoftwareinc / ghactions-manager

A plugin to manage GitHub actions from JetBrains IDEs (intellij, pycharm, etc.)
Other
56 stars 13 forks source link

API Exceeded Rate Limiting #173

Closed mallowigi closed 2 months ago

mallowigi commented 2 months ago

Recently I'm encountering a lot of issues related to GitHub rate limiting errors

CleanShot 2024-07-09 at 14 28 07

I opened an issue on JetBrains YouTrack but after checking in the logs I found out that this is caused by this plugin. After removing the plugin the issue is no longer happening.

What I found out is that this plugin is sending a lot of graphql requests to retrieve GitHub workflows, and this happens even though I changed the GitHub token in the settings, and the reason found in the logs is the following:

024-07-09 18:57:27,088 [ 112190]   WARN - #com.dsoftware.ghmanager.psi.service.GitHubActionDataService - Failed to get latest version of repo [REDACTED]/frontend-workflows
java.net.SocketTimeoutException: Read timed out
    at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:288)
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:314)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:355)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:808)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
    at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
    at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
    at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1465)
    at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1069)
    at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
    at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
    at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:343)
    at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:826)
    at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:761)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1710)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1611)
    at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:308)
    at org.jetbrains.plugins.github.api.GithubApiRequestExecutor$Base.checkResponseCode(GithubApiRequestExecutor.kt:151)
    at org.jetbrains.plugins.github.api.GithubApiRequestExecutor$Base.execute$lambda$1(GithubApiRequestExecutor.kt:107)
    at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:529)
    at com.intellij.util.io.HttpRequests.process(HttpRequests.java:511)
    at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:340)
    at org.jetbrains.plugins.github.api.GithubApiRequestExecutor$Base.execute(GithubApiRequestExecutor.kt:98)
    at com.dsoftware.ghmanager.api.GhApiRequestExecutor.execute(GhApiRequestExecutor.kt:41)
    at org.jetbrains.plugins.github.api.GithubApiRequestExecutor.execute(GithubApiRequestExecutor.kt:49)
    at com.dsoftware.ghmanager.psi.service.GitHubActionDataService.resolveRemoteActionData(GitHubActionDataService.kt:175)
    at com.dsoftware.ghmanager.psi.service.GitHubActionDataService.resolveGithubAction(GitHubActionDataService.kt:161)
    at com.dsoftware.ghmanager.psi.service.GitHubActionDataService.access$resolveGithubAction(GitHubActionDataService.kt:30)
    at com.dsoftware.ghmanager.psi.service.GitHubActionDataService$resolveActions$$inlined$runAsync$1.run(promise.kt:470)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)

I assume it's happening because it's a GitHub private organization repository and somehow the plugin doesn't manage to read the workflows repository. As a result, a loop happens and GraphQL requests are sent every second, which implodes the rate limiting of GitHub.

2024-07-09 18:57:27,091 [ 112193]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:27,091 [ 112193]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:
{"query":"query LatestRelease($owner:String!,$name:String!) {\n    repository(owner:$owner, name:$name){\n        latestRelease{\n            tag{\n                name\n            }\n        }\n        refs(refPrefix: \"refs/tags/\", first: 1, orderBy:{ field: TAG_COMMIT_DATE, direction: DESC}) {\n            nodes{\n                name\n            }\n        }\n    }\n}\n","variables":{"owner":"[REDACTED]","name":"frontend-workflows"}} : Connected
2024-07-09 18:57:30,220 [ 115322]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:30,221 [ 115323]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:30,226 [ 115328]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:
{"query":"query LatestRelease($owner:String!,$name:String!) {\n    repository(owner:$owner, name:$name){\n        latestRelease{\n            tag{\n                name\n            }\n        }\n        refs(refPrefix: \"refs/tags/\", first: 1, orderBy:{ field: TAG_COMMIT_DATE, direction: DESC}) {\n            nodes{\n                name\n            }\n        }\n    }\n}\n","variables":{"owner":"[REDACTED]","name":"frontend-workflows"}} : Connected
2024-07-09 18:57:30,228 [ 115330]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:
{"query":"query LatestRelease($owner:String!,$name:String!) {\n    repository(owner:$owner, name:$name){\n        latestRelease{\n            tag{\n                name\n            }\n        }\n        refs(refPrefix: \"refs/tags/\", first: 1, orderBy:{ field: TAG_COMMIT_DATE, direction: DESC}) {\n            nodes{\n                name\n            }\n        }\n    }\n}\n","variables":{"owner":"[REDACTED]","name":"frontend-workflows"}} : Connected
2024-07-09 18:57:30,229 [ 115331]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:30,229 [ 115331]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:30,230 [ 115332]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: https://api.github.com/graphql null : Connecting
2024-07-09 18:57:30,230 [ 115332]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:
{"query":"query LatestRelease($owner:String!,$name:String!) {\n    repository(owner:$owner, name:$name){\n        latestRelease{\n            tag{\n                name\n            }\n        }\n        refs(refPrefix: \"refs/tags/\", first: 1, orderBy:{ field: TAG_COMMIT_DATE, direction: DESC}) {\n            nodes{\n                name\n            }\n        }\n    }\n}\n","variables":{"owner":"[REDACTED]","name":"frontend-workflows"}} : Connected
2024-07-09 18:57:30,230 [ 115332]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:
{"query":"query LatestRelease($owner:String!,$name:String!) {\n    repository(owner:$owner, name:$name){\n        latestRelease{\n            tag{\n                name\n            }\n        }\n        refs(refPrefix: \"refs/tags/\", first: 1, orderBy:{ field: TAG_COMMIT_DATE, direction: DESC}) {\n            nodes{\n                name\n            }\n        }\n    }\n}\n","variables":{"owner":"[REDACTED]","name":"frontend-workflows"}} : Connected
2024-07-09 18:57:30,230 [ 115332]   FINE - #o.j.p.g.a.GithubApiRequestExecutor - Request: POST https://api.github.com/graphql with body:

Upvote & Fund

Fund with Polar

cunla commented 2 months ago

Generally, there is a mechanism that prevents asking for the same action data over and over again if there are errors. However, I noticed there might be an error if there are more than one / in the action name - which I assume is your case. I will publish a fix.

cunla commented 2 months ago

solved in 2024.2.5

mallowigi commented 2 months ago

Thanks. When is it going to be available? It's not on JetBrains Marketplace at the moment.

cunla commented 2 months ago

this week I will release it