python icon indicating copy to clipboard operation
python copied to clipboard

BrokenPipeError on interface.close() via HTTP

Open jangrewe opened this issue 1 year ago • 0 comments

I've just installed the meshtastic-cli and wanted to snoop around one of my nodes via HTTP, and while the --nodes argument prints the output nicely, the --info argument results in an exception (after printing some/most? of the output):

$  meshtastic --host 192.168.0.71 --info
Connected to radio

Owner: NBS14 Base Station (NBS)
My info: { "myNodeNum": 1129714436, "rebootCount": 86, "minAppVersion": 30200 }
Metadata: { "firmwareVersion": "2.5.4.8d288d5", "deviceStateVersion": 23, "canShutdown": true, "hasWifi": true, "hasBluetooth": true, "positionFlags": 811, "hwModel": "HELTEC_WIRELESS_PAPER", "hasPKC": true, "hasEthernet": false, "role": "CLIENT", "hasRemoteHardware": false }

[... nodes and config ...]

Channels:
  Index 0: PRIMARY psk=default { "psk": "AQ==", "uplinkEnabled": true, "downlinkEnabled": true, "moduleSettings": { "positionPrecision": 32, "isClientMuted": false }, "channelNum": 0, "name": "", "id": 0 }

Primary channel URL: https://meshtastic.org/e/#CgsSAQEoATABOgIIIBIMCAE4A0ADSAFQG2gB

ERROR file:stream_interface.py __reader line:210 Unexpected OSError, terminating meshtastic reader... [Errno 104] Connection reset by peer
Aborting due to: [Errno 32] Broken pipe
Traceback (most recent call last):
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/__main__.py", line 946, in onConnected
    interface.close()  # after running command then exit
    ^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/tcp_interface.py", line 61, in close
    StreamInterface.close(self)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/stream_interface.py", line 121, in close
    MeshInterface.close(self)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 138, in close
    self._sendDisconnect()
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 926, in _sendDisconnect
    self._sendToRadio(m)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 951, in _sendToRadio
    self._sendToRadioImpl(toRadio)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/stream_interface.py", line 116, in _sendToRadioImpl
    self._writeBytes(header + b)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/tcp_interface.py", line 74, in _writeBytes
    self.socket.send(b)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/bin/meshtastic", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/__main__.py", line 1901, in main
    common()
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/__main__.py", line 1211, in common
    onConnected(client)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/__main__.py", line 954, in onConnected
    interface.close()  # close the connection now, so that our app exits
    ^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/tcp_interface.py", line 61, in close
    StreamInterface.close(self)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/stream_interface.py", line 121, in close
    MeshInterface.close(self)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 138, in close
    self._sendDisconnect()
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 926, in _sendDisconnect
    self._sendToRadio(m)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/mesh_interface.py", line 951, in _sendToRadio
    self._sendToRadioImpl(toRadio)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/stream_interface.py", line 116, in _sendToRadioImpl
    self._writeBytes(header + b)
  File "/root/.local/pipx/venvs/meshtastic/lib/python3.11/site-packages/meshtastic/tcp_interface.py", line 74, in _writeBytes
    self.socket.send(b)
BrokenPipeError: [Errno 32] Broken pipe

Package version:

$ meshtastic --version
2.5.2

jangrewe avatar Oct 14 '24 07:10 jangrewe