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

[release/8.0][wasm] Use intended ports when running DevServer #92906

Merged
merged 5 commits into from Oct 3, 2023

Conversation

radical
Copy link
Member

@radical radical commented Oct 2, 2023

For running a wasm-browser application DevServer is used, but it always started the webserver on port 5000, because the selected ports weren't used by the DevServer, and thus used the defaults.

...
      [] Unhandled exception. System.IO.IOException: Failed to bind to address http://127.0.0.1:5000: address already in use.
...
  • Also, ignore empty ASPNETCORE_URLS='' in the environment.

Fixes #91143 .

Customer impact

Every run for a wasmbrowser template (which is still only in the wasm-experimental workload) will use a random port for the webserver, instead of a fixed 5000, as intended.

Testing

Automated testing.

Impact

Low. This affects an experimental feature.

@radical radical added arch-wasm WebAssembly architecture area-Build-mono labels Oct 2, 2023
@radical radical requested a review from maraf October 2, 2023 21:24
@ghost ghost assigned radical Oct 2, 2023
@ghost
Copy link

ghost commented Oct 2, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

For running a wasm-browser application DevServer is used, but it always started the webserver on port 5000, because the selected ports weren't used by the DevServer, and thus used the defaults.

    Wasm.Build.Tests.TestAppScenarios.LibraryInitializerTests.LoadLibraryInitializer [STARTING]
       Expected 0 exit code but got -532462766: C:\helix\work\workitem\e\dotnet-latest\dotnet.exe run -c Debug --no-build
      Standard Output:
      [] WasmAppHost --use-staticwebassets --runtime-config C:\helix\work\workitem\e\wbt\LibraryInitializerTests_LoadLibraryInitializer_dl4w1qgh_jty\bin\Debug\net8.0\WasmBasicTestApp.runtimeconfig.json
      [] Unhandled exception. System.IO.IOException: Failed to bind to address http://127.0.0.1:5000: address already in use.
      []  ---> Microsoft.AspNetCore.Connections.AddressInUseException: Only one usage of each socket address (protocol/network address/port) is normally permitted.
      []  ---> System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
      []    at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
      []    at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
      []    at System.Net.Sockets.Socket.Bind(EndPoint localEP)
      []    at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
      []    at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
      []    --- End of inner exception stack trace ---
      []    at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
      []    at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
      [] --- End of stack trace from previous location ---
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
      []    --- End of inner exception stack trace ---
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.DefaultAddressStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func`2 useHttps, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
      []    at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
      []    at Microsoft.WebAssembly.AppHost.DevServer.DevServer.StartAsync(DevServerOptions options, ILogger logger, CancellationToken token)
      []    at Microsoft.WebAssembly.AppHost.BrowserHost.StartWebServerAsync(BrowserArguments args, String[] urls, CancellationToken token)
      []    at Microsoft.WebAssembly.AppHost.BrowserHost.RunAsync(ILoggerFactory loggerFactory, CancellationToken token)
      []    at Microsoft.WebAssembly.AppHost.BrowserHost.InvokeAsync(CommonConfiguration commonArgs, ILoggerFactory loggerFactory, ILogger logger, CancellationToken token)
      []    at Microsoft.WebAssembly.AppHost.WasmAppHost.Main(String[] args)
      []    at Microsoft.WebAssembly.AppHost.WasmAppHost.<Main>(String[] args)
  • Also, ignore empty ASPNETCORE_URLS='' in the environment.

Fixes #88832 .

Author: radical
Assignees: -
Labels:

arch-wasm, area-Build-mono

Milestone: -

@radical radical added the Servicing-consider Issue for next servicing release review label Oct 2, 2023
@radical radical changed the title [releaes/8.0][wasm] Use intended ports when running DevServer [release/8.0][wasm] Use intended ports when running DevServer Oct 2, 2023
@radical
Copy link
Member Author

radical commented Oct 3, 2023

Test failure is relevant.

@carlossanlop carlossanlop added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 3, 2023
@carlossanlop
Copy link
Member

Approved by Tactics via email.

Test failure is relevant.

@radical ping me when the test failure is addressed so I can merge. I'll add the blocked label meanwhile.

@carlossanlop carlossanlop added the blocked Issue/PR is blocked on something - see comments label Oct 3, 2023
@radical radical removed the blocked Issue/PR is blocked on something - see comments label Oct 3, 2023
@radical
Copy link
Member Author

radical commented Oct 3, 2023

@carlossanlop this is ready.

@radical radical deleted the wasm-app-host-fix-v8 branch October 6, 2023 20:11
@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants