Code Monkey home page Code Monkey logo

Comments (4)

affektde avatar affektde commented on June 16, 2024 2

Adding [email protected] to Wants and After to my /etc/systemd/system/blitzapi.service systemd-Unit helped.

Now the API is working after restarting my node. No more toaster and errors in blitzapi.service.

Maybe [email protected] is doing something with the network-system of linux and than interrupts the API service.

[Unit]   
Description=BlitzBackendAPI                                                                             
Wants=network.target [email protected]                                                        
After=network.target mnt-hdd.mount [email protected]

[Service]
WorkingDirectory=/home/blitzapi/blitz_api
# before every start update the config with latest credentials/settings
ExecStartPre=-/home/admin/config.scripts/blitz.web.api.sh update-config
ExecStart=/usr/bin/python -m uvicorn app.main:app --port 11111 --host=0.0.0.0 --root-path /api
User=blitzapi
Group=blitzapi
Type=simple
Restart=always
StandardOutput=journal
StandardError=journal
RestartSec=60

# Hardening
PrivateTmp=true

[Install]
WantedBy=multi-user.target

from tunnelsats.

ziggie1984 avatar ziggie1984 commented on June 16, 2024 2

Fix is on the dev branch (1dffde4), needs some testing before its good to go for main branch

from tunnelsats.

affektde avatar affektde commented on June 16, 2024 1

sudo systemctl restart blitzapi after unlocking the wallet, gets the API up and running again.

Okay, here some logs, where the API get stuck after a fresh restart:

Aug 24 21:47:40 raspberrypi python[1629363]: ERROR:asyncio:Task exception was never retrieved
Aug 24 21:47:40 raspberrypi python[1629363]: future: <Task finished name='Task-32' coro=<_handle_forward_event_listener() done, defined at ./app/repositories/lightning.py:236> exception=HTTPException(status_code=500, detail='htlc event subscription terminated')>
Aug 24 21:47:40 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:47:40 raspberrypi python[1629363]:   File "./app/repositories/ln_impl/lnd_grpc.py", line 687, in listen_forward_events
Aug 24 21:47:40 raspberrypi python[1629363]:     async for e in _router_stub.SubscribeHtlcEvents(request):
Aug 24 21:47:40 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/grpc/aio/_call.py", line 326, in _fetch_stream_responses
Aug 24 21:47:40 raspberrypi python[1629363]:     await self._raise_for_status()
Aug 24 21:47:40 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/grpc/aio/_call.py", line 236, in _raise_for_status
Aug 24 21:47:40 raspberrypi python[1629363]:     raise _create_rpc_error(await self.initial_metadata(), await
Aug 24 21:47:40 raspberrypi python[1629363]: grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
Aug 24 21:47:40 raspberrypi python[1629363]:         status = StatusCode.UNKNOWN
Aug 24 21:47:40 raspberrypi python[1629363]:         details = "htlc event subscription terminated"
Aug 24 21:47:40 raspberrypi python[1629363]:         debug_error_string = "{"created":"@1661374060.858941679","description":"Error received from peer ipv4:127.0.0.1:10009","file":"src/core/lib/surface/call.cc","file_line":952,"grpc_message":"htlc event subscription terminated","grpc_status":2}"
Aug 24 21:47:40 raspberrypi python[1629363]: >
Aug 24 21:47:40 raspberrypi python[1629363]: During handling of the above exception, another exception occurred:
Aug 24 21:47:40 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:47:40 raspberrypi python[1629363]:   File "./app/repositories/lightning.py", line 256, in _handle_forward_event_listener
Aug 24 21:47:40 raspberrypi python[1629363]:     async for i in ln.listen_forward_events():
Aug 24 21:47:40 raspberrypi python[1629363]:   File "./app/repositories/ln_impl/lnd_grpc.py", line 715, in listen_forward_events
Aug 24 21:47:40 raspberrypi python[1629363]:     raise HTTPException(
Aug 24 21:47:40 raspberrypi python[1629363]: fastapi.exceptions.HTTPException: 500
Aug 24 21:47:54 raspberrypi python[1629363]: INFO:     127.0.0.1:43312 - "GET /lightning/list-all-tx?reversed=true HTTP/1.0" 200 OK
Aug 24 21:48:01 raspberrypi python[1629363]: ERROR:asyncio:Task exception was never retrieved
Aug 24 21:48:01 raspberrypi python[1629363]: future: <Task finished name='Task-30' coro=<_handle_info_listener() done, defined at ./app/repositories/lightning.py:207> exception=HTTPException(status_code=500, detail='failed to connect to all addresses')>
Aug 24 21:48:01 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:48:01 raspberrypi python[1629363]:   File "./app/repositories/ln_impl/lnd_grpc.py", line 600, in get_ln_info_impl
Aug 24 21:48:01 raspberrypi python[1629363]:     response = await _lnd_stub.GetInfo(req)
Aug 24 21:48:01 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/grpc/aio/_call.py", line 290, in __await__
Aug 24 21:48:01 raspberrypi python[1629363]:     raise _create_rpc_error(self._cython_call._initial_metadata,
Aug 24 21:48:01 raspberrypi python[1629363]: grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
Aug 24 21:48:01 raspberrypi python[1629363]:         status = StatusCode.UNAVAILABLE
Aug 24 21:48:01 raspberrypi python[1629363]:         details = "failed to connect to all addresses"
Aug 24 21:48:01 raspberrypi python[1629363]:         debug_error_string = "{"created":"@1661374081.525292545","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3217,"referenced_errors":[{"created":"@1661374081.525289434","description":"failed to connect to all addresses","file":"src/core/lib/transport/error_utils.cc","file_line":165,"grpc_status":14}]}"
Aug 24 21:48:01 raspberrypi python[1629363]: >
Aug 24 21:48:01 raspberrypi python[1629363]: During handling of the above exception, another exception occurred:
Aug 24 21:48:01 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:48:01 raspberrypi python[1629363]:   File "./app/repositories/lightning.py", line 211, in _handle_info_listener
Aug 24 21:48:01 raspberrypi python[1629363]:     info = await ln.get_ln_info_impl()
Aug 24 21:48:01 raspberrypi python[1629363]:   File "./app/repositories/ln_impl/lnd_grpc.py", line 604, in get_ln_info_impl
Aug 24 21:48:01 raspberrypi python[1629363]:     raise HTTPException(
Aug 24 21:48:01 raspberrypi python[1629363]: fastapi.exceptions.HTTPException: 500
Aug 24 21:48:02 raspberrypi python[1629363]: ERROR:asyncio:Task exception was never retrieved
Aug 24 21:48:02 raspberrypi python[1629363]: future: <Task finished name='Task-22' coro=<_handle_gather_bitcoin_status() done, defined at ./app/repositories/bitcoin.py:147> exception=ClientConnectorError(ConnectionKey(host='127.0.0.1', port=8332, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-5377278191959812478), ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 8332)"))>
Aug 24 21:48:02 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     raise exceptions[0]
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     sock = await self._connect_sock(
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
Aug 24 21:48:02 raspberrypi python[1629363]:     await self.sock_connect(sock, address)
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
Aug 24 21:48:02 raspberrypi python[1629363]:     return await fut
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
Aug 24 21:48:02 raspberrypi python[1629363]:     raise OSError(err, f'Connect call failed {address}')
Aug 24 21:48:02 raspberrypi python[1629363]: ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 8332)
Aug 24 21:48:02 raspberrypi python[1629363]: The above exception was the direct cause of the following exception:
Aug 24 21:48:02 raspberrypi python[1629363]: Traceback (most recent call last):
Aug 24 21:48:02 raspberrypi python[1629363]:   File "./app/repositories/bitcoin.py", line 151, in _handle_gather_bitcoin_status
Aug 24 21:48:02 raspberrypi python[1629363]:     info = await get_btc_info()
Aug 24 21:48:02 raspberrypi python[1629363]:   File "./app/repositories/bitcoin.py", line 95, in get_btc_info
Aug 24 21:48:02 raspberrypi python[1629363]:     binfo = await get_blockchain_info()
Aug 24 21:48:02 raspberrypi python[1629363]:   File "./app/repositories/bitcoin.py", line 54, in get_blockchain_info
Aug 24 21:48:02 raspberrypi python[1629363]:     result = await bitcoin_rpc_async("getblockchaininfo")
Aug 24 21:48:02 raspberrypi python[1629363]:   File "./app/repositories/bitcoin_utils.py", line 72, in bitcoin_rpc_async
Aug 24 21:48:02 raspberrypi python[1629363]:     async with session.post(bitcoin_config.rpc_url, data=data) as resp:
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 1138, in __aenter__
Aug 24 21:48:02 raspberrypi python[1629363]:     self._resp = await self._coro
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 535, in _request
Aug 24 21:48:02 raspberrypi python[1629363]:     conn = await self._connector.connect(
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 542, in connect
Aug 24 21:48:02 raspberrypi python[1629363]:     proto = await self._create_connection(req, traces, timeout)
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 907, in _create_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     _, proto = await self._create_direct_connection(req, traces, timeout)
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     raise last_exc
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     transp, proto = await self._wrap_create_connection(
Aug 24 21:48:02 raspberrypi python[1629363]:   File "/usr/local/lib/python3.9/dist-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
Aug 24 21:48:02 raspberrypi python[1629363]:     raise client_error(req.connection_key, exc) from exc
Aug 24 21:48:02 raspberrypi python[1629363]: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:8332 ssl:default [Connect call failed ('127.0.0.1', 8332)]
Aug 24 21:48:09 raspberrypi systemd[1]: Stopping BlitzBackendAPI...
Aug 24 21:48:09 raspberrypi python[1629363]: INFO:     Shutting down
Aug 24 21:48:09 raspberrypi python[1629363]: INFO:uvicorn.error:Shutting down

from tunnelsats.

cstenglein avatar cstenglein commented on June 16, 2024

The Toaster at the top right displays the status The UI gets from The blitzAPI which in turn gets it from the raspiblitz.
So looks like an issue that LND or at least the RPC service is not starting.

@rootzoll @fusion44 any ideas?

from tunnelsats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.