#I have this error as well, but its
1 messages Β· Page 1 of 1 (latest)
Okay, so we didn't break it, phew. I'd go and just check which enabled integrations do use aiohttp and go from there.
π
Indeed, indeed. Was worried as we started to have aiohttp as a dep just recently.
I have 130 integrations enabled, how can I help with this π
Like if it came from an integration I'd expect to have a "closed session" more often than an unclosed session
I actually don't know how much I have enabled
Spook
Nope
From a task/thread
So wait
More like await
Basically, something forgets to call close() on the aiohttp client session. It's coming from the __del__: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L316
I'd start looking at libraries that implements aenter, it's easy to forget the closing part there π
i can reload intregrations but it I would have to do that a max of 129 times....if you have less integraions...maybe you could try?
I see this error in safe mode as well
How much integrations do you have
jq '.data.entries[].domain' config/.storage/core.config_entries | sort | uniq >> config/test.txt
@wispy vector
@halcyon acorn
oh is this for the list issue?
no for the unclosed session issue
oh
I saw you responding into it that you had the same problem
lemme check
It's just a list of my integrations.
"alarmo"
"apple_tv"
"august"
"blitzortung"
"bluetooth"
"cloud"
"co2signal"
"delonghi_primadonna"
"dlna_dmr"
"dyson_local"
"esphome"
"forecast_solar"
"generic"
"geo_json_events"
"geonetnz_quakes"
"hacs"
"hassio"
"holiday"
"homeassistant_sky_connect"
"homekit"
"homekit_controller"
"ibeacon"
"imap"
"local_calendar"
"localtuya"
"managemyhealth"
"meridian_energy"
"mobile_app"
"netatmo"
"onvif"
"oralb"
"panasonic_cc"
"private_ble_device"
"profiler"
"raspberry_pi"
"rpi_power"
"samsungtv"
"sma"
"spook"
"sun"
"switch_as_x"
"switch_manager"
"template"
"thread"
"tplink"
"twinkly"
"upnp"
"withings"
"workday"
"xbox"
"xiaomi_ble"
"xiaomi_miot"
"yalexs_ble"
"yeelock"
"zha"
I know, one of these is the culprit
If I had to take a completely random guess on which change caused it, it would be this one - https://github.com/home-assistant/core/pull/109658 - could be wrong though
I don't have that one
Wait, this might be even my own integration lol
@oak bobcat do you use Withings?
I donβt. I can get my list in a few
Checked the georss integration. The current version does not use aiohttp
In my case, for example, the error did not occur at all
Fun fact, I can't reproduce this anymore
I checked all recent package bumps but couldn't find anything that has caused this
I don't have withings, if that helps
do I type this in terminal to get a file for list of integrations?
yes
"adguard"
"airthings"
"airthings_ble"
"androidtv"
"androidtv_remote"
"apple_tv"
"blink"
"bluetooth"
"cast"
"cloud"
"coinbase"
"denonavr"
"derivative"
"dlna_dmr"
"dlna_dms"
"dyson_local"
"epson"
"esphome"
"extended_openai_conversation"
"fastdotcom"
"filesize"
"fitbit"
"fully_kiosk"
"gasbuddy"
"generic"
"glances"
"google"
"google_assistant_sdk"
"google_mail"
"google_sheets"
"google_tasks"
"google_translate"
"govee_ble"
"group"
"hacs"
"hass_agent"
"hassio"
"heos"
"homeassistant_sky_connect"
"homekit_controller"
"hue"
"ibeacon"
"imap"
"improv_ble"
"inkbird"
"integration"
"ipp"
"lametric"
"led_ble"
"llama_conversation"
"local_calendar"
"local_todo"
"lutron_caseta"
"matter"
"meater"
"melnor"
"met"
"mobile_app"
"moon"
"mqtt"
"nanoleaf"
"nest"
"nest_protect"
"nexia"
"nfandroidtv"
"nut"
"openai_conversation"
"opower"
"oralb"
"otbr"
"profiler"
"proximity"
"radio_browser"
"raspberry_pi"
"rpi_power"
"samsungtv"
"shelly"
"spook"
"spotify"
"sun"
"switch_as_x"
"switchbot"
"systemmonitor"
"thermopro"
"thread"
"upnp"
"voip"
"wemo"
"wiz"
"workday"
"wyoming"
"xbox"
"yalexs_ble"
"youtube"
"zha"
"zwave_js"
interesting your command said I have 97 lines for integrations, but spook says I have 130 integrations....maybe there are some missing
but anyways, thats what I get from your command
oh, okay thanks
so far its not adgaurd, airthings, android tv, generic camera...
even on restart?
π
probably need this, maybe?
~~```
logger:
default: debug
logs:
aiohttp: access
aiohttp: client
aiohttp: internal
aiohttp: server
aiohttp: web
aiohttp: websocket
Definitly not, that is invalid
ahh yes, this:
logger:
default: debug
logs:
aiohttp.access: debug
aiohttp.client: debug
aiohttp.internal: debug
aiohttp.server: debug
aiohttp.web: debug
aiohttp.websocket: debug
Which is redudndant, the default covers all those
Restarted again and its gone again
local_calendar maybe?
I use local_calendar too, and I don't have this error. And afaik local_calendar has no dependency on aiohttp
I have these in common with the previous lists:
apple_tv
bluetooth
cloud
dlna_dmr
esphome
hacs
hassio
homekit_controller
ibeacon
local_calendar
mobile_app
oralb
sun
switch_as_x
thread
upnp
zha
unless I made a mistake comparing them π
Here's my full list:
"adaptive_lighting"
"adguard"
"airvisual"
"alexa_media"
"androidtv_remote"
"apple_tv"
"bluetooth"
"broadlink"
"brother"
"cast"
"cloud"
"dlna_dmr"
"ecowitt"
"elevenlabs_tts"
"esphome"
"eufylife_ble"
"extended_openai_conversation"
"google"
"govee_lan"
"group"
"hacs"
"hassio"
"homeassistant_yellow"
"homekit"
"homekit_controller"
"hue"
"ibeacon"
"improv_ble"
"iqvia"
"lifx"
"local_calendar"
"local_todo"
"mobile_app"
"moon"
"mqtt"
"nest"
"nws"
"opengarage"
"opensprinkler"
"oralb"
"pirateweather"
"plex"
"proximity"
"reolink"
"roku"
"roomba"
"scrypted"
"shelly"
"sonos"
"spotify"
"sun"
"switch_as_x"
"systemmonitor"
"tasmota"
"template"
"thread"
"tod"
"unifi"
"unifiprotect"
"upnp"
"uptime"
"voip"
"webrtc"
"winix"
"wiz"
"wled"
"wyoming"
"xiaomi_ble"
"zha"
"zwave_js"
"adaptive_lighting"
"adguard"
"airvisual"
"alexa_media"
"androidtv_remote"
"apple_tv"
"bluetooth"
"broadlink"
"brother"
"cast"
"cloud"
"dlna_dmr"
"ecowitt"
"elevenlabs_tts"
"esphome"
"eufylife_ble"
"extended_openai_conversation"
"google"
"govee_lan"
"group"
"hacs"
"hassio"
"homeassistant_yellow"
"homekit"
"homekit_controller"
"hue"
"ibeacon"
"improv_ble"
"iqvia"
"lifx"
"local_calendar"
"local_todo"
"mobile_app"
"moon"
"mqtt"
"nest"
"nws"
"opengarage"
"opensprinkler"
"oralb"
"pirateweather"
"plex"
"proximity"
"reolink"
"roku"
"roomba"
"scrypted"
"shelly"
"sonos"
"spotify"
"sun"
"switch_as_x"
"systemmonitor"
"tasmota"
"template"
"thread"
"tod"
"unifi"
"unifiprotect"
"upnp"
"uptime"
"voip"
"webrtc"
"winix"
"wiz"
"wled"
"wyoming"
"xiaomi_ble"
"zha"
"zwave_js"
ok I have the error back after a restart with local_calendar disabled.
it took a few times
I did enable oralb again π€·ββοΈ No idea
I think I also have this list more or less
But the rest of these integrations sounds widely used so I would expect more people to have this issue
had a couple of logs this morning, which may be related to this...not sure:
Logger: homeassistant
Source: runner.py:145
First occurred: February 5, 2024 at 3:34:50 PM (2 occurrences)
Last logged: 5:17:32 AM
Error doing job: Unclosed client session
Error doing job: Task was destroyed but it is pending!
and
Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 12:26:30 AM (1 occurrences)
Last logged: 12:26:30 AM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 350, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message:
Data after `Connection: close`:
b'HELP'
^
Is there someone in your basement who isn't up to date of the http standard?
π³
basement office
But this is certainly weird
But can you solidly reproduce it?
I think this is the first time I've seen this
so I can only keep an eye out for it
being at 12:26 am, almost everyone was sleeping...perhaps I was on my phone so it could be related to the android app
What about that unclosed session?
yes, on every startup
Hmm strange
FYI still getting it on b9
Logger: homeassistant
Source: runner.py:145
First occurred: 4:54:39 PM (1 occurrences)
Last logged: 4:54:39 PM
Error doing job: Unclosed client session
still getting it too
Now, looking at this PR (https://github.com/home-assistant/core/pull/57602) I would have thought that we should be able to see more about where these originate from but even with full debug log enabled I am unable to.
What was that about Withings?
Ffs Cody, i wanted to wake up in peace π
Is there a straightforward way to enable hass --verbose mode when using HAOS?
Depends, what is βverbose modeβ?π
https://www.home-assistant.io/integrations/logger/ isn't that just setting the default logger to debug?
it looks like --debug is passed through from main to the runner then to asyncio which should then give us our traceback
I was sure I tried that but let me try again
nope
I don't get the traceback with that
what on earth - my logger is well and truly broken!
*Logger: bleak_esphome.backend.client
Source: custom_components/geo_json_events/manager.py:74
Integration: GeoJSON
First occurred: 19:54:47 (1 occurrences)
Last logged: 19:54:47
esphome-lounge [4C:75:25:XXXXXX]: LI00XXX - 98:1B:B5:XXXXXX: ESPHomeClient bleak client was not properly disconnected before destruction*
https://github.com/home-assistant/core/blob/dev/homeassistant/__main__.py#L201
I dont think that can be changed without changing the source in the container
yes, it's what I was looking at - may well just do that
okay
so that works and I got a full stack trace
simply changed debug=args.debug, to debug=True, and rebooted
I found what was causing mine, some moron custom_integrations developer (no prizes for guessing who it was!)
If you do the above, you will get a traceback that looks like below which will give you exactly where the cause is:
2024-02-07 20:04:10.172 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session: File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 221, in <module>
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 188, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 671, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 638, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1966, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 963, in _async_init
flow = await self.async_create_flow(handler, context=context, data=data)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1080, in async_create_flow
flow = handler()
File "/config/custom_components/yeelock/config_flow.py", line 51, in init
self._session = aiohttp.ClientSession()
yeelock looks familiar π€
Was that new in this beta?
no, I submitted PR for it and immediately got shot down for not having two BLE calls in a standalone library which might be what you are remembering
I doubt it, I dont look much at core PRs anymore π
https://github.com/hacs/default/pull/2150 there it is π
ohhhhh - thanks for that too!
@tender cargo @wispy vector if you want to repro that unclosed client session, start hass with --debug flags enabled
Thanks id be happy to try that...but how do I do that?
It doesn't seem to follow the standard logging in config yaml your instructions
You would have to exec into the container, modify the source code directly, and then exit out before restarting.
if any or those words are unfamiliar, do not attempt it
Lol you're basically saying I should make another backup of my home assistant
Not at all, Im saying do not do it like at all, if this is not something you know
Okay I'll leave it for now as I'm not sure BUT perhaps if joostlek does it he might identify the integration we share
Right I'll give this a shot
as in
I waited since I can't reproduce this consistently
but I forgot my medicaiton today so my concentration span is like 5 seconds holy shit
so might as well give it a shot
yes
my head rn
and I got distracted again
apparently there is a VSCode plugin to show subway surfers on the side
to keep the flow of dopamine going when programming
OFC there is π
2024-02-07 14:52:07.720 WARNING (MainThread) [asyncio] Executing <Task pending name='Task-7043' coro=<RequestHandler._handle_request() running at /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:452> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/local/lib/python3.12/asyncio/base_events.py:447> cb=[Task.task_wakeup()] created at /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:527> took 0.140 seconds
2024-02-07 14:52:08.825 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session: File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/__main__.py", line 221, in <module>
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 188, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 671, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 638, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1966, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 442, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/src/homeassistant/homeassistant/components/hue/__init__.py", line 22, in async_setup_entry
if not await bridge.async_initialize_bridge():
File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 76, in async_initialize_bridge
await self.api.initialize()
File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 107, in initialize
await self.fetch_full_state()
File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 247, in fetch_full_state
full_state = await self.request("get", "clip/v2/resource")
File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 167, in request
async with self.create_request(method, path, **kwargs) as resp:
File "/usr/local/lib/python3.12/contextlib.py", line 210, in __aenter__
return await anext(self.gen)
File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 200, in create_request
self._websession = aiohttp.ClientSession(connector=connector)
@tender cargo ah yes. same with hue here
Strickter things in py3.12 probably
fair
This specific parts have not changed in 2-3 years
so its hue? if I try to reload my hue integration it should give the error
I guess