Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2578) #38

Open
syphernl opened this issue May 5, 2023 · 17 comments

Comments

@syphernl
Copy link

syphernl commented May 5, 2023

Seeing this after updating HASS to 2023.5.x when starting up.

2023-05-05 11:42:29.748 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
Traceback (most recent call last):
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 784, in async_device_update
    await coro
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
  File "/home/hass/.homeassistant/custom_components/google_fit/sensor.py", line 321, in update
    weight_data = weight_request.execute()
  File "/srv/hass/lib/python3.10/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/srv/hass/lib/python3.10/site-packages/googleapiclient/http.py", line 923, in execute
    resp, content = _retry_request(
  File "/srv/hass/lib/python3.10/site-packages/googleapiclient/http.py", line 222, in _retry_request
    raise exception
  File "/srv/hass/lib/python3.10/site-packages/googleapiclient/http.py", line 191, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "/srv/hass/lib/python3.10/site-packages/oauth2client/transport.py", line 173, in new_request
    resp, content = request(orig_request_method, uri, method, body,
  File "/srv/hass/lib/python3.10/site-packages/oauth2client/transport.py", line 280, in request
    return http_callable(uri, method=method, body=body, headers=headers,
  File "/srv/hass/lib/python3.10/site-packages/httplib2/__init__.py", line 1701, in request
    (response, content) = self._request(
  File "/srv/hass/lib/python3.10/site-packages/httplib2/__init__.py", line 1421, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/srv/hass/lib/python3.10/site-packages/httplib2/__init__.py", line 1373, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.10/ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.10/ssl.py", line 1130, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2578)

Oddly, while some sensors work just fine (e.g. steps, move time) the one for distance is not.

@daniperaleda
Copy link

Same error here since upgrade....help please

@WhimsySpoon
Copy link

Same as above, but this component is now holding up HA core restarts by a couple of minutes, possibly due to this issue.

@daniperaleda
Copy link

Same as above, but this component is now holding up HA core restarts by a couple of minutes, possibly due to this issue.

I haven't noticed it....but it is the same...it restarts periodically due to this topic

@daniperaleda
Copy link

Still having the problem. I have tested the API in the Google Developer Console and its works well. It is hapenning to me in the Weight and in the Heart Rate sensor. I am going to try adding new scopes...

@AlexKusnezov
Copy link

AlexKusnezov commented May 9, 2023

same here, I had heart rate, weight and height sensors failing over time. I also had random restarts of HA Core at least once a day, not entirely sure if it's related though. but since I've disabled. HA is now up for 24hours+

@daniperaleda
Copy link

Still having the problems. I have put in the code sleep 2 or 3 seconds if it could be related to timeouts...but still with problems with sensors...

@syphernl
Copy link
Author

syphernl commented May 9, 2023

I haven't noticed it....but it is the same...it restarts periodically due to this topic

@daniperaleda Does your HASS still restart? If so, do you have a home-assistant.log.fault file in your HASS folder by any chance?

@AlexKusnezov
Copy link

AlexKusnezov commented May 9, 2023

@syphernl I have one:

Current thread 0x0000007f38f309d8 (most recent call first):
  File "/usr/local/lib/python3.10/ssl.py", line 1130 in read
  File "/usr/local/lib/python3.10/ssl.py", line 1274 in recv_into
  File "/usr/local/lib/python3.10/socket.py", line 705 in readinto
  File "/usr/local/lib/python3.10/http/client.py", line 279 in _read_status
  File "/usr/local/lib/python3.10/http/client.py", line 318 in begin
  File "/usr/local/lib/python3.10/http/client.py", line 1375 in getresponse
  File "/usr/local/lib/python3.10/site-packages/httplib2/__init__.py", line 1396 in _conn_request
  File "/usr/local/lib/python3.10/site-packages/httplib2/__init__.py", line 1444 in _request
  File "/usr/local/lib/python3.10/site-packages/httplib2/__init__.py", line 1724 in request
  File "/usr/local/lib/python3.10/site-packages/google_auth_httplib2.py", line 218 in request
  File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 163 in _retry_request
  File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 835 in execute
  File "/usr/local/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133 in positional_wrapper
  File "/config/custom_components/google_fit/sensor.py", line 332 in _get_dataset
  File "/config/custom_components/google_fit/sensor.py", line 963 in update
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190 in wrapper
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190 in wrapper
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58 in run
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 83 in _worker
  File "/usr/local/lib/python3.10/threading.py", line 953 in run
  File "/usr/local/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
  File "/usr/local/lib/python3.10/threading.py", line 973 in _bootstrap

Right now it's running for 24+ hours without any restarts (with integration disabled). Never hat a restert before I updated to 2023.5 and google_fit sensors started failing

@daniperaleda
Copy link

I haven't noticed it....but it is the same...it restarts periodically due to this topic

@daniperaleda Does your HASS still restart? If so, do you have a home-assistant.log.fault file in your HASS folder by any chance?

It is a big file...but the last one that appears...(I have rebooted manually several times trying to fix the problem is this)

Thread 0x00007f5e15f7fb30 (most recent call first):
File "/usr/local/lib/python3.10/ssl.py", line 1130 in read
File "/usr/local/lib/python3.10/ssl.py", line 1274 in recv_into
File "/usr/local/lib/python3.10/socket.py", line 705 in readinto
File "/usr/local/lib/python3.10/http/client.py", line 279 in _read_status
File "/usr/local/lib/python3.10/http/client.py", line 318 in begin
File "/usr/local/lib/python3.10/http/client.py", line 1375 in getresponse
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1396 in _conn_request
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1444 in _request
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1724 in request
File "/usr/local/lib/python3.10/site-packages/google_auth_httplib2.py", line 218 in request
File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 163 in _retry_request
File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 835 in execute
File "/usr/local/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133 in positional_wrapper
File "/config/custom_components/google_fit/sensor.py", line 345 in _get_dataset
File "/config/custom_components/google_fit/sensor.py", line 1096 in update
File "/usr/src/homeassistant/homeassistant/util/init.py", line 190 in wrapper
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58 in run
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 83 in _worker
File "/usr/local/lib/python3.10/threading.py", line 953 in run
File "/usr/local/lib/python3.10/threading.py", line 1016 in _bootstrap_inner
File "/usr/local/lib/python3.10/threading.py", line 973 in _bootstrap

@daniperaleda
Copy link

Anyway, right now what I get most is TIMEOUT...this is an example

Logger: homeassistant.helpers.entity
Source: custom_components/google_fitdpp/sensor.py:340
Integration: google_fit
First occurred: 13:49:16 (8 occurrences)
Last logged: 13:49:16

Update for sensor.google_fit_oxygen fails
Update for sensor.google_fit_blood_pressure_sys fails
Update for sensor.google_fit_blood_pressure_dia fails
Update for sensor.google_fit_nutrition fails
Update for sensor.google_fit_hydratation fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 554, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await coro
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/init.py", line 190, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/google_fit/sensor.py", line 678, in update
for point in self._get_dataset(self.DATA_SOURCE)["point"]:
File "/config/custom_components/google_fit/sensor.py", line 340, in _get_dataset
return self._client.users().dataSources().datasets().get(userId=API_USER_ID, dataSourceId=source, datasetId=dataset).execute()
File "/usr/local/lib/python3.10/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 835, in execute
resp, content = _retry_request(
File "/usr/local/lib/python3.10/site-packages/googleapiclient/http.py", line 163, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/google_auth_httplib2.py", line 218, in request
response, content = self.http.request(
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1724, in request
(response, content) = self._request(
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1444, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/local/lib/python3.10/site-packages/httplib2/init.py", line 1396, in _conn_request
response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1375, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 279, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.10/socket.py", line 705, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.10/ssl.py", line 1274, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.10/ssl.py", line 1130, in read
return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out

@syphernl
Copy link
Author

syphernl commented May 9, 2023

@daniperaleda @AlexKusnezov Which HASS versions do you run? Does this happen with HASS 2023.5.0 too? Or only with 2023.5.1 or 2023.5.2?
For some reason my HASS kept on crashing ~hourly with a segmentation fault since I upgraded beyond the .0 version. After downgrading to .0 it now works fine (except every reboot a random number of sensors for this integration is missing).

@AlexKusnezov
Copy link

AlexKusnezov commented May 9, 2023

@syphernl it happened with 2023.5.0 , then I updated and then it happened with 2023.5.1, which I'm currently on

@daniperaleda
Copy link

I have it in 2023.5.2...but happened in all 2023.5.x

One comment...I have put time.sleep(1) in some parts of the code...and it is getting better...for example I am getting the heart rate sensor.

So it seems that there is limitations in the HA side for sockets or SLL calls

@daniperaleda
Copy link

Downgraded to 2023.4.6....and all the sensors worked fine....so for me is a limitation of the version 2023.5.x

@syphernl
Copy link
Author

After upgrading my setup to Alpine 3.18 / Python 3.11 HASS started crashing on the 2023.5.0 version as well.
Once I disabled this custom integration it stopped crashing. It is now running fine on 2023.5.2 too without crashing.

ISTM something in this integration causes HASS to segfault 😢

@daniperaleda
Copy link

I am still in version 2023.4.6...decided to downgrade as causing inestability...so for sure is a problem with the version 2023.5.x...do you know that has changed something in the calls, sockets or SSL?

@daniperaleda
Copy link

After migratin to 2023.5.3...it works stable with theis Google Fit integration...is it ok for all you too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants