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

[Bug] "division by zero" error #152

Closed
frakoch opened this issue Apr 24, 2024 · 11 comments
Closed

[Bug] "division by zero" error #152

frakoch opened this issue Apr 24, 2024 · 11 comments
Labels
bug Something isn't working stale

Comments

@frakoch
Copy link

frakoch commented Apr 24, 2024

Describe the issue

I just updated to master via HACS to test out the new version and immediately found this in the logs (+ the integration not loading). I have a pool that is offline, which might be the cause of this, but nevertheless the values should be sanitized before using them.

How to reproduce the issue

not sure, I suppose offlining a pool

Expected behavior

component should initialize and run :)

Screenshots

Software versions

  • Home Assistant version: HA 24.04.3
  • TrueNAS integration version: d4cd011 (in case "master" update via HACS did work correctly)
  • TrueNAS version: scale 23.10.2

Diagnostics data

Logger: custom_components.truenas.coordinator
Source: helpers/update_coordinator.py:315
Integration: TrueNAS (Dokumentation, Issues)

Unexpected error fetching BRAIN data: float division by zero
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/coordinator.py", line 104, in _async_update_data
    await self.hass.async_add_executor_job(self.get_pool)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/truenas/coordinator.py", line 782, in get_pool
    self.ds["pool"][uid]["available_gib"]
ZeroDivisionError: float division by zero

Traceback/Error logs

Additional context

@frakoch frakoch added the bug Something isn't working label Apr 24, 2024
@tomaae
Copy link
Owner

tomaae commented Apr 24, 2024

I will need debugs to see what happened there. Seems like you truenas is sending faulty data.

@frakoch
Copy link
Author

frakoch commented Apr 25, 2024

there you go, hope it helps: https://paste.kodi.tv/bunanonine.kodi

It seems that it is related to the boot-pool? At least the exception seems to occur when processing the boot-pool

edit: I migrated to TrueNAS Dragonfish-24.04.0 in the meantime. The debug is from the API responses of this version
edit2: I also switched to your beta release now, since I read in the other issue that installing the main GH branch seems to fail in times with HACS

@tomaae
Copy link
Owner

tomaae commented Apr 25, 2024

It is actually caused by offline pool. How did you took the pool offline?
I will fix this when I get home.

'id': 7, 'name': 'tank', 'guid': 'XXX', 'path': '/mnt/tank', 'status': 'OFFLINE',

@frakoch
Copy link
Author

frakoch commented Apr 25, 2024

HDDs are temporarily unplugged. Didn't want to deal with TrueNAS complaining about SMB shares pointing to a missing pool, permissions and what not

@tomaae
Copy link
Owner

tomaae commented Apr 25, 2024

ok, that should be easy to simulate in VM

@tomaae tomaae closed this as completed in 2c5ed51 Apr 25, 2024
@frakoch
Copy link
Author

frakoch commented Apr 26, 2024

thanks. I can confirm it's working now. The only thing "missing" is that the sensor sensor.NAME_datasets_POOLNAME seems not to get created in this state, while all other related sensors (ZFS health etc) are still present (even though empty). Not a big thing, just something I noticed.

@tomaae
Copy link
Owner

tomaae commented Apr 26, 2024

do you mean size sensor for tank pool?

@frakoch
Copy link
Author

frakoch commented Apr 26, 2024

yeah. In my case I see sensor.brain_datasets_data (and all its child datasets) but no sensor.brain_datasets_tank. However sensor.brain_system_tank_free f.e. is there (although 0/undefined ofc)

@tomaae tomaae reopened this Apr 26, 2024
@tomaae
Copy link
Owner

tomaae commented Apr 26, 2024

I will look into it

@github-actions github-actions bot added the stale label May 11, 2024
Repository owner deleted a comment from github-actions bot May 11, 2024
@github-actions github-actions bot removed the stale label Jul 26, 2024
Copy link

github-actions bot commented Aug 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 9, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants