h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 324 forks source link

Live reload shuts down waved on Windows. #2074

Closed mturoci closed 11 months ago

mturoci commented 12 months ago

Discussed in https://github.com/h2oai/wave/discussions/2067

Originally posted by **MisterArbazzz** July 7, 2023 Why does live reloading not work in my H2O Wave app? I am unable to see the changes in the Wave app as I am coding, and I have to restart the app to see the effect. I trying to run this demo app and making some changes in it but whenever i make change to the code. ![image](https://github.com/h2oai/wave/assets/87564754/3abee4a0-0de6-41dd-be27-7c2032abc97f) I get this error ``` WARNING: StatReload detected changes in 'app.py'. Reloading... INFO: Started server process [8720] INFO: Waiting for application startup. ERROR: Traceback (most recent call last): File "c:\python37\lib\site-packages\anyio\_core\_sockets.py", line 167, in try_connect stream = await asynclib.connect_tcp(remote_host, remote_port, local_address) File "c:\python37\lib\site-packages\anyio\_backends\_asyncio.py", line 1628, in connect_tcp StreamProtocol, host, port, local_addr=local_addr File "c:\python37\lib\asyncio\base_events.py", line 962, in create_connection raise exceptions[0] File "c:\python37\lib\asyncio\base_events.py", line 949, in create_connection await self.sock_connect(sock, address) File "c:\python37\lib\asyncio\selector_events.py", line 473, in sock_connect return await fut File "c:\python37\lib\asyncio\selector_events.py", line 503, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 10101) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\python37\lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions yield File "c:\python37\lib\site-packages\httpcore\_backends\anyio.py", line 117, in connect_tcp local_host=local_address, File "c:\python37\lib\site-packages\anyio\_core\_sockets.py", line 225, in connect_tcp raise OSError("All connection attempts failed") from cause OSError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\python37\lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions yield File "c:\python37\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request resp = await self._pool.handle_async_request(req) File "c:\python37\lib\site-packages\httpcore\_async\connection_pool.py", line 262, in handle_async_request raise exc File "c:\python37\lib\site-packages\httpcore\_async\connection_pool.py", line 245, in handle_async_request response = await connection.handle_async_request(request) File "c:\python37\lib\site-packages\httpcore\_async\connection.py", line 92, in handle_async_request raise exc File "c:\python37\lib\site-packages\httpcore\_async\connection.py", line 69, in handle_async_request stream = await self._connect(request) File "c:\python37\lib\site-packages\httpcore\_async\connection.py", line 117, in _connect stream = await self._network_backend.connect_tcp(**kwargs) File "c:\python37\lib\site-packages\httpcore\_backends\auto.py", line 36, in connect_tcp socket_options=socket_options, File "c:\python37\lib\site-packages\httpcore\_backends\anyio.py", line 121, in connect_tcp stream._raw_socket.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover File "c:\python37\lib\contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "c:\python37\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\python37\lib\site-packages\starlette\routing.py", line 686, in lifespan async with self.lifespan_context(app) as maybe_state: File "c:\python37\lib\site-packages\starlette\routing.py", line 575, in __aenter__ await self._router.startup() File "c:\python37\lib\site-packages\starlette\routing.py", line 663, in startup await handler() File "c:\python37\lib\site-packages\h2o_wave\server.py", line 303, in _register raise exception File "c:\python37\lib\site-packages\h2o_wave\server.py", line 293, in _register key_secret=_config.app_access_key_secret, File "c:\python37\lib\site-packages\h2o_wave\server.py", line 241, in call content=marshal({method: kwargs}), File "c:\python37\lib\site-packages\httpx\_client.py", line 1861, in post extensions=extensions, File "c:\python37\lib\site-packages\httpx\_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "c:\python37\lib\site-packages\httpx\_client.py", line 1621, in send history=[], File "c:\python37\lib\site-packages\httpx\_client.py", line 1648, in _send_handling_auth history=history, File "c:\python37\lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) File "c:\python37\lib\site-packages\httpx\_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) File "c:\python37\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request resp = await self._pool.handle_async_request(req) File "c:\python37\lib\contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "c:\python37\lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: All connection attempts failed ERROR: Application startup failed. Exiting. ``` and app shuts down ![image](https://github.com/h2oai/wave/assets/87564754/a15d84d6-06ae-4a19-b76e-f39b290e983c) i am using the latest h2o-wave Version: 0.26.1 with python 3.7.9 on windows 11 I need to see the changes in the wave ui as i am coding (also i tried it using both vscode and pycharm) Can someone please assist me. @mturoci
mturoci commented 12 months ago

Tmp workaround: pip install uvicorn==0.21.1 as this was introduced in latest, 0.22.0.

Caused by https://github.com/encode/uvicorn/pull/1584.