issues icon indicating copy to clipboard operation
issues copied to clipboard

Windows 10 - ERROR Exception in callback _ProactorReadPipeTransport._loop_reading() after uploading

Open BSwitchblade88 opened this issue 10 months ago • 4 comments

The problem

After compiling and uploading on Windows, the output window fills with log errors (as below) instead of the output from the ESP32. After an short period the browser window freezes and requires a page reload UNLESS the log output is closed quickly within a couple of seconds.

This behaviour only appears on my Win10 PC and not my Debian Docker image.

Unfortunately I have little experience with Python to be able to help narrow down the cause. It's not breaking functionality, only usability - but I can work around this be accessing the ESP32's web server to read logs instead.

Which version of ESPHome has the issue?

2024.12.4

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

No response

Component causing the issue

No response

YAML Config


Anything in the logs that might be useful for us?

INFO ESPHome 2024.12.4
INFO Reading configuration E:/esphome/meterboard.yaml...
INFO Generating C++ source...
INFO Updating https://github.com/espressif/[email protected]
INFO Compiling app...
Processing meterboard (board: lolin_s2_mini; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32.git#51.03.07)
--------------------------------------------------------------------------------
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.50105.0 (5.1.5) 
 - tool-cmake @ 3.21.3 
 - tool-esptoolpy @ 4.8.1 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823 
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 12.2.0+20230208 
 - toolchain-xtensa-esp32s2 @ 12.2.0+20230208
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.6
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs\meterboard\src\main.cpp.o
In file included from src/esphome\components\adc\adc_sensor.h:9,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
C:/Users/benja/.platformio/packages/framework-espidf/components/esp_adc/deprecated/include/esp_adc_cal.h:17:2: warning: #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h" [-Wcpp]
   17 | #warning "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h"
      |  ^~~~~~~
In file included from src/esphome\components\adc\adc_sensor.h:10:
C:/Users/benja/.platformio/packages/framework-espidf/components/driver/deprecated/driver/adc.h:19:2: warning: #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively" [-Wcpp]
   19 | #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively"
      |  ^~~~~~~
Linking .pioenvs\meterboard\firmware.elf
RAM:   [=         ]  10.0% (used 32628 bytes from 327680 bytes)
Flash: [=====     ]  49.3% (used 904102 bytes from 1835008 bytes)
Building .pioenvs\meterboard\firmware.bin
Creating esp32s2 image...
Successfully created esp32s2 image.
esp32_create_combined_bin([".pioenvs\meterboard\firmware.bin"], [".pioenvs\meterboard\firmware.elf"])
Wrote 0xecd10 bytes to file E:\esphome\.esphome\build\meterboard\.pioenvs\meterboard/firmware.factory.bin, ready to flash to offset 0x0
esp32_copy_ota_bin([".pioenvs\meterboard\firmware.bin"], [".pioenvs\meterboard\firmware.elf"])
========================= [SUCCESS] Took 11.55 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.223 port 3232...
INFO Connected to 192.168.0.223
INFO Uploading E:/esphome\.esphome\build\meterboard\.pioenvs\meterboard\firmware.bin (904464 bytes)
Uploading: [=                                                           ] 0% Uploading: [=                                                           ] 1% Uploading: [==                                                          ] 2% Uploading: [==                                                          ] 3% Uploading: [===                                                         ] 4% Uploading: [===                                                         ] 5% Uploading: [====                                                        ] 6% Uploading: [====                                                        ] 7% Uploading: [=====                                                       ] 8% Uploading: [=====                                                       ] 9% Uploading: [=======                                                     ] 10% Uploading: [=======                                                     ] 11% Uploading: [========                                                    ] 12% Uploading: [========                                                    ] 13% Uploading: [=========                                                   ] 14% Uploading: [=========                                                   ] 15% Uploading: [==========                                                  ] 16% Uploading: [==========                                                  ] 17% Uploading: [===========                                                 ] 18% Uploading: [===========                                                 ] 19% Uploading: [============                                                ] 20% Uploading: [=============                                               ] 21% Uploading: [==============                                              ] 22% Uploading: [==============                                              ] 23% Uploading: [===============                                             ] 24% Uploading: [===============                                             ] 25% Uploading: [================                                            ] 26% Uploading: [================                                            ] 27% Uploading: [=================                                           ] 28% Uploading: [==================                                          ] 29% Uploading: [==================                                          ] 30% Uploading: [===================                                         ] 31% Uploading: [====================                                        ] 32% Uploading: [====================                                        ] 33% Uploading: [=====================                                       ] 34% Uploading: [=====================                                       ] 35% Uploading: [======================                                      ] 36% Uploading: [======================                                      ] 37% Uploading: [=======================                                     ] 38% Uploading: [========================                                    ] 39% Uploading: [========================                                    ] 40% Uploading: [=========================                                   ] 41% Uploading: [==========================                                  ] 42% Uploading: [==========================                                  ] 43% Uploading: [===========================                                 ] 44% Uploading: [===========================                                 ] 45% Uploading: [============================                                ] 46% Uploading: [============================                                ] 47% Uploading: [=============================                               ] 48% Uploading: [==============================                              ] 49% Uploading: [==============================                              ] 50% Uploading: [===============================                             ] 51% Uploading: [================================                            ] 52% Uploading: [================================                            ] 53% Uploading: [=================================                           ] 54% Uploading: [=================================                           ] 55% Uploading: [==================================                          ] 56% Uploading: [==================================                          ] 57% Uploading: [===================================                         ] 58% Uploading: [====================================                        ] 59% Uploading: [====================================                        ] 60% Uploading: [=====================================                       ] 61% Uploading: [=====================================                       ] 62% Uploading: [======================================                      ] 63% Uploading: [=======================================                     ] 64% Uploading: [=======================================                     ] 65% Uploading: [========================================                    ] 66% Uploading: [========================================                    ] 67% Uploading: [=========================================                   ] 68% Uploading: [==========================================                  ] 69% Uploading: [==========================================                  ] 70% Uploading: [===========================================                 ] 71% Uploading: [===========================================                 ] 72% Uploading: [============================================                ] 73% Uploading: [=============================================               ] 74% Uploading: [=============================================               ] 75% Uploading: [==============================================              ] 76% Uploading: [===============================================             ] 77% Uploading: [===============================================             ] 78% Uploading: [================================================            ] 79% Uploading: [================================================            ] 80% Uploading: [=================================================           ] 81% Uploading: [=================================================           ] 82% Uploading: [==================================================          ] 83% Uploading: [===================================================         ] 84% Uploading: [===================================================         ] 85% Uploading: [====================================================        ] 86% Uploading: [=====================================================       ] 87% Uploading: [=====================================================       ] 88% Uploading: [======================================================      ] 89% Uploading: [======================================================      ] 90% Uploading: [=======================================================     ] 91% Uploading: [=======================================================     ] 92% Uploading: [========================================================    ] 93% Uploading: [=========================================================   ] 94% Uploading: [=========================================================   ] 95% Uploading: [==========================================================  ] 96% Uploading: [=========================================================== ] 97% Uploading: [=========================================================== ] 98% Uploading: [============================================================] 99% Uploading: [============================================================] 100% Done...

INFO Upload took 6.04 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.0.223 using esphome API
INFO Successfully connected to meterboard @ 192.168.0.223 in 7.028s
C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\backends\default\ciphers.py:10: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior
  return self.cipher.encrypt(nonce=self.format_nonce(n), data=plaintext, associated_data=ad)
C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\backends\default\ciphers.py:13: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior
  return self.cipher.decrypt(nonce=self.format_nonce(n), data=ciphertext, associated_data=ad)
INFO Successful handshake with meterboard @ 192.168.0.223 in 0.596s
[15:05:24][I][app:100]: ESPHome version 2024.12.4 compiled on Feb  9 2025, 15:04:59
[15:05:24][C][wifi:600]: WiFi:
[15:05:24][C][wifi:428]:   Local MAC: 80:65:99:FB:FE:7E
[15:05:24][C][wifi:433]:   SSID: 'TCBB227B'[redacted]
[15:05:24][C][wifi:436]:   IP Address: 192.168.0.223
[15:05:24][C][wifi:439]:   BSSID: A4:91:B1:BB:22:7B[redacted]
[15:05:24][C][wifi:441]:   Hostname: 'meterboard'
ERROR Exception in callback _ProactorReadPipeTransport._loop_reading()
handle: <Handle _ProactorReadPipeTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 325, in _loop_reading
    self._data_received(data, length)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 274, in _data_received
    self._protocol.data_received(data)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 163, in data_received
    self._handle_frame(frame)
    ~~~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 326, in _handle_frame
    self._connection.process_packet((type_high << 8) | type_low, msg[4:])
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\connection.py", line 933, in process_packet
    handler(msg)
    ~~~~~~~^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\esphome\components\api\client.py", line 46, in on_log
    print(f"[{time_.hour:02}:{time_.minute:02}:{time_.second:02}]{text}")
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\colorama\ansitowin32.py", line 47, in write
    self.__convertor.write(text)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\colorama\ansitowin32.py", line 177, in write
    self.write_and_convert(text)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\colorama\ansitowin32.py", line 205, in write_and_convert
    self.write_plain_text(text, cursor, len(text))
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\colorama\ansitowin32.py", line 210, in write_plain_text
    self.wrapped.write(text[start:end])
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 71-72: character maps to <undefined>
ERROR Exception in callback _ProactorReadPipeTransport._loop_reading()
handle: <Handle _ProactorReadPipeTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 325, in _loop_reading
    self._data_received(data, length)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 274, in _data_received
    self._protocol.data_received(data)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 163, in data_received
    self._handle_frame(frame)
    ~~~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 319, in _handle_frame
    msg = self._decrypt(frame)
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\state.py", line 74, in decrypt_with_ad
    plaintext = self.cipher.decrypt(self.k, self.n, ad, ciphertext)
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\backends\default\ciphers.py", line 13, in decrypt
    return self.cipher.decrypt(nonce=self.format_nonce(n), data=ciphertext, associated_data=ad)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptography.exceptions.InvalidTag
ERROR Exception in callback _ProactorReadPipeTransport._loop_reading()
handle: <Handle _ProactorReadPipeTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 325, in _loop_reading
    self._data_received(data, length)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\asyncio\proactor_events.py", line 274, in _data_received
    self._protocol.data_received(data)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 163, in data_received
    self._handle_frame(frame)
    ~~~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\aioesphomeapi\_frame_helper\noise.py", line 319, in _handle_frame
    msg = self._decrypt(frame)
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\state.py", line 74, in decrypt_with_ad
    plaintext = self.cipher.decrypt(self.k, self.n, ad, ciphertext)
  File "C:\Users\benja\AppData\Local\Programs\Python\Python313\Lib\site-packages\noise\backends\default\ciphers.py", line 13, in decrypt
    return self.cipher.decrypt(nonce=self.format_nonce(n), data=ciphertext, associated_data=ad)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



[Log repeats continuously]

Additional information

No response

BSwitchblade88 avatar Feb 09 '25 05:02 BSwitchblade88