Connection failed: too many redirects
Is there an existing issue for this?
- [X] I have searched the existing issues
Are you sure that this bug is related to this DDEV Integration Plugin?
- [X] I am sure
Enter your error report ID (If available)
No response
Describe the bug
In Ubuntu 22.04.4 LTS with PhpStorm 2024.1.2.
After install plugin get IDE internal error:
java.io.IOException: Connection failed: too many redirects
at com.intellij.util.io.HttpRequests.openConnection(HttpRequests.java:660)
at com.intellij.util.io.HttpRequests$RequestImpl.getConnection(HttpRequests.java:366)
at com.intellij.util.io.HttpRequests$RequestImpl.doReadBytes(HttpRequests.java:442)
at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:431)
at com.intellij.util.io.RequestBuilder.lambda$readString$5(RequestBuilder.java:85)
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 com.intellij.util.io.RequestBuilder.readString(RequestBuilder.java:85)
at de.php_perfect.intellij.ddev.version.GithubClient.loadCurrentVersion(GithubClient.java:27)
at de.php_perfect.intellij.ddev.version.VersionCheckerImpl$1.run(VersionCheckerImpl.java:48)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:250)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:46)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:250)
at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:500)
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)
Steps to reproduce
No response
Additional context
No response
This is caused in the file:
https://github.com/php-perfect/ddev-intellij-plugin/blob/main/src/main/java/de/php_perfect/intellij/ddev/version/GithubClient.java#L22
I continue analyzing the problem
I'm also getting this. I'm using an M2 Mac running Sonoma OS with PhpStorm 2024.1.3 and OrbStack.
could it help as first "workaround" to just wrap the requestBuilder with a try-catch to catch the exception, return null and continue with all the other tasks of the plugin - I mean it's "only" for the check if there is a newer ddev-version available currently it seems as if the whole plugin crashes if this occurs
Looking at the code in HttpRequests, redirectLimit is a highly misleading misnomer. The way the code is written it's actually expecting a request count limit. So in this case, with a redirect followed by the second and final request, a value of 2.
You can also see this in the IntelliJ Community test suite: https://github.com/JetBrains/intellij-community/blob/451d49f1dde29a396096d1ed7c761c6afab62e68/platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.kt#L89