Skip to content

VS Code extension does not use proxy settings #1147

Closed

Description

@lfvJonas

Describe the bug
We use a company proxy and the Spring Language Server is unable to reach external resources. On the same device it is possible to curl the same resource from the terminal.

Issue relates to #1101 and #498

I expect that it's the same issue as the first one since we get the same logs. But in that issue only a fix is made for Eclipse and not VSCode.

VSCode gets its proxy settings from the enviroment varibles http_proxy and https_proxy.

To Reproduce
(Ubuntu 22.04.3 LTS, VSCode 1.84.2, Spring Boot Tools v1.50.0)

  1. Use proxy with authentication
  2. Set enviroment varibles http_proxy and https_proxy
  3. Start up VSCode
  4. Get these errorlog in vscode-spring-boot-debug-log output after about 60 secs
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:52 AM] Client vscode-spring-boot: connection to server is erroring. Shutting down server.
[Error - 8:44:54 AM] Stopping server timed out
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23
[Error - 8:44:54 AM] Stopping server failed
Error: Stopping the server timed out
	at /home/u70565/.vscode/extensions/vmware.vscode-spring-boot-1.50.0/node_modules/vscode-languageclient/lib/common/client.js:933:23

and when I log to file I get theses:

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://api.spring.io/projects": Network is unreachable
	at org.springframework.web.client.RestTemplate.createResourceAccessException(RestTemplate.java:888)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:868)
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:804)
	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:665)
	at org.springframework.ide.vscode.boot.validation.generations.SpringProjectsClient.get(SpringProjectsClient.java:79)
	at org.springframework.ide.vscode.boot.validation.generations.SpringProjectsClient.fromEmbedded(SpringProjectsClient.java:57)
	at org.springframework.ide.vscode.boot.validation.generations.SpringProjectsClient.getSpringProjects(SpringProjectsClient.java:44)
	at org.springframework.ide.vscode.boot.validation.generations.SpringIoProjectsProvider.cache(SpringIoProjectsProvider.java:84)
	at org.springframework.ide.vscode.boot.validation.generations.SpringIoProjectsProvider.getProject(SpringIoProjectsProvider.java:75)
	at org.springframework.ide.vscode.boot.validation.generations.UpdateBootVersion.validate(UpdateBootVersion.java:49)
	at org.springframework.ide.vscode.boot.validation.generations.ProjectVersionDiagnosticProvider.getDiagnostics(ProjectVersionDiagnosticProvider.java:60)
	at org.springframework.ide.vscode.boot.validation.BootVersionValidationEngine.reconcile(BootVersionValidationEngine.java:50)
	at org.springframework.ide.vscode.boot.common.ProjectReconcileScheduler.lambda$scheduleValidation$0(ProjectReconcileScheduler.java:85)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at org.springframework.ide.vscode.boot.common.ProjectReconcileScheduler.lambda$scheduleValidation$1(ProjectReconcileScheduler.java:83)
	at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:171)
	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539)
	at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Network is unreachable
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Unknown Source)
	at java.base/sun.nio.ch.Net.connect(Unknown Source)
	at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
	at java.base/java.net.Socket.connect(Unknown Source)
	at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
	at org.springframework.http.client.OkHttp3ClientHttpRequest.executeInternal(OkHttp3ClientHttpRequest.java:68)
	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:862)
	... 23 common frames omitted
	Suppressed: java.net.SocketTimeoutException: Connect timed out
		at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
		... 47 common frames omitted
	Suppressed: java.net.SocketTimeoutException: Connect timed out
		at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
		... 47 common frames omitted
	Suppressed: java.net.SocketException: Network is unreachable
		... 50 common frames omitted

Activity

  1. changed the title [-]VSCode extention does not use proxy settings[/-] [+]VS Code extention does not use proxy settings[/+] on Nov 20, 2023
  2. changed the title [-]VS Code extention does not use proxy settings[/-] [+]VS Code extension does not use proxy settings[/+] on Nov 20, 2023
  3. added this to the 4.21.0.RELEASE milestone on Nov 21, 2023
  4. BoykoAlex commented on Nov 28, 2023

    @BoykoAlex
    Contributor

    @lfvJonas There is legacy http.proxy setting in VSCode from where Boot LS reads the proxy URL. Could you please give this a try? Note that once you set this value you'd need to restart (or reload window) the VSCode for the setting to take effect?
    There are also http.proxy-user and http.proxy-password for the case of the authenticated proxy.
    Please give the above a try.

  5. lfvJonas commented on Nov 29, 2023

    @lfvJonas
    Author

    @BoykoAlex I set the http.proxy explicity and it now works!
    But I am still a little confused since it says in the setting that.

    The proxy setting to use. If not set, will be inherited from the http_proxy and https_proxy environment variables.

    Which it apperantly it did not, since those are set correcly.

  6. lfvJonas commented on Nov 29, 2023

    @lfvJonas
    Author

    When I looked a little futher I can see that the proxy is being used correctly by other extentions when it's not set explicity.

    Using this ticket for dubug reference: microsoft/vscode#84845

    It's only this extension that has trubble when it's not set explicitly

  7. BoykoAlex commented on Nov 29, 2023

    @BoykoAlex
    Contributor

    I have added support for http_proxy environment variables as well improved support for http.proxy setting: 2cfa020
    Please give it a try tomorrow perhaps :-) See vscode .vsix file link for Spring Boot VSCode extension at the bottom of this page: https://cdn.spring.io/spring-tools/snapshot/STS4/nightly-distributions.html

  8. lfvJonas commented on Nov 30, 2023

    @lfvJonas
    Author

    @BoykoAlex Tested it out right now and it works as expected 🙏

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

Metadata

Metadata

Assignees

Labels

for: vscodetype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions