uwolfer / gerrit-intellij-plugin

Gerrit Code Review Tool Integration for the IntelliJ Platform
Apache License 2.0
495 stars 103 forks source link

Gerrit behind a proxy not working #484

Open sivasuc opened 1 year ago

sivasuc commented 1 year ago

I have configured a global proxy in my windows machine. it's a SOCKS proxy created by ssh -D command that routes traffic through an ssh tunnel. It works flawlessly in chrome/edge/intellij. I have intellij setup to use it in the Proxy settings page. This page contains a button that allows you to test your proxy by reaching given urls. It succeeds for gerrit url.

image

Configuring a gerrit instance in Gerrit plugin's settings page and pressing the Test connection button fails and the following appears in the log file (real hostname masked by "server_name":

2023-09-01 18:11:53,157 [13715952] INFO - STDOUT - 2023-09-01 18:12:02,024 [13724819] INFO - org.apache.http.impl.execchain.RetryExec - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:18888->https://server_name:443: The target server failed to respond 2023-09-01 18:12:02,024 [13724819] INFO - org.apache.http.impl.execchain.RetryExec - Retrying request to {tls}->http://127.0.0.1:18888->https://server_name:443 2023-09-01 18:12:02,025 [13724820] INFO - org.apache.http.impl.execchain.RetryExec - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:18888->https://server_name:443: The target server failed to respond 2023-09-01 18:12:02,025 [13724820] INFO - org.apache.http.impl.execchain.RetryExec - Retrying request to {tls}->http://127.0.0.1:18888->https://gerrit.ericsson.se:443 2023-09-01 18:12:02,026 [13724821] INFO - org.apache.http.impl.execchain.RetryExec - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:18888->https://server_name:443: The target server failed to respond 2023-09-01 18:12:02,026 [13724821] INFO - org.apache.http.impl.execchain.RetryExec - Retrying request to {tls}->http://127.0.0.1:18888->https://server_name:443 2023-09-01 18:12:02,027 [13724822] INFO - gerrit - com.google.gerrit.extensions.restapi.RestApiException: Request failed. java.lang.RuntimeException: com.google.gerrit.extensions.restapi.RestApiException: Request failed. at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil.accessToGerritWithModalProgress(GerritUtil.java:132) at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil.checkCredentials(GerritUtil.java:608) at com.urswolfer.intellij.plugin.gerrit.ui.SettingsPanel$1.actionPerformed(SettingsPanel.java:97) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385) at java.desktop/java.awt.Component.processEvent(Component.java:6422) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4954) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4581) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4522) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2808) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:794) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:766) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:763) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:633) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:588) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121) at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236) at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234) at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234) at java.desktop/java.awt.Dialog.lambda$show$2(Dialog.java:1081) at java.desktop/sun.awt.SunToolkit.performOnMainThreadIfNeeded(SunToolkit.java:2164) at java.desktop/java.awt.Dialog.show(Dialog.java:1041) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:737) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:462) at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1685) at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1643) at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.kt:104) at com.intellij.ide.actions.ShowSettingsAction.perform(ShowSettingsAction.java:60) at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:47) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:339) at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:313) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:362) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:313) at com.intellij.openapi.actionSystem.ex.ActionUtil.invokeAction(ActionUtil.java:538) at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:266) at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$3(ActionPopupStep.java:243) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1625) at com.intellij.openapi.wm.impl.FocusManagerImpl.lambda$doWhenFocusSettlesDown$3(FocusManagerImpl.java:173) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:33) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.kt:210) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.kt:176) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:169) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1623) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:165) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:394) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:129) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:161) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:262) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:250) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:273) at com.intellij.ui.popup.list.ListPopupImpl.disposePopup(ListPopupImpl.java:496) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:523) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:483) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:429) at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:699) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6657) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385) at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:764) at java.desktop/java.awt.Component.processEvent(Component.java:6422) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4954) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4581) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4522) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2808) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4855) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:794) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:766) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:764) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:763) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:633) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:588) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) Caused by: com.google.gerrit.extensions.restapi.RestApiException: Request failed. at com.google.gerrit.extensions.restapi.RestApiException.wrap(RestApiException.java:25) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.requestJson(GerritRestClient.java:165) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.getRequest(GerritRestClient.java:119) at com.urswolfer.gerrit.client.rest.http.changes.ChangesRestClient.get(ChangesRestClient.java:113) at com.urswolfer.gerrit.client.rest.http.changes.ChangesRestClient.access$000(ChangesRestClient.java:38) at com.urswolfer.gerrit.client.rest.http.changes.ChangesRestClient$1.get(ChangesRestClient.java:78) at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil.testConnection(GerritUtil.java:584) at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil$18.compute(GerritUtil.java:612) at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil$18.compute(GerritUtil.java:608) at com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil$1.run(GerritUtil.java:122) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:428) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:115) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:512) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:87) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:251) at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:71) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173) at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:71) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:251) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:465) 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:833) Caused by: org.apache.http.NoHttpResponseException: gerrit.ericsson.se:443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.execchain.MainClientExec.createTunnelToTarget(MainClientExec.java:485) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:410) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at com.urswolfer.gerrit.client.rest.http.HttpRequestExecutor.execute(HttpRequestExecutor.java:34) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.tryGerritHttpAuth(GerritRestClient.java:349) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.updateGerritAuth(GerritRestClient.java:304) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.updateGerritAuthWhenRequired(GerritRestClient.java:298) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.request(GerritRestClient.java:200) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.requestRest(GerritRestClient.java:181) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.requestRest(GerritRestClient.java:173) at com.urswolfer.gerrit.client.rest.http.GerritRestClient.requestJson(GerritRestClient.java:150) ... 31 more 2023-09-01 18:12:02,031 [13724826] INFO - STDOUT -

The connection to the same gerrit server works just fine in a proxy-less environment. Other functionalities of intellij or other plugins have no trouble reaching through the proxy.

127.0.0.1:18888 is the address of the SOCKS proxy.