FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Leaking open files when running gpiod.find_line() · Issue #32 · hhk7734/python3-gpiod · GitHub

This repository was archived by the owner on May 20, 2024. It is now read-only.
/ python3-gpiod Public archive
This repository was archived by the owner on May 20, 2024. It is now read-only.

Leaking open files when running gpiod.find_line() #32

Description

This is a small step-by-step to reproduce the error:

  • Have a named pin on any chip above gpiochip0.
  • Run this code, substitute the GPIO_NAME:
import gpiod
for i in range(1025):
  a = gpiod.find_line("GPIO_NAME")

This results in an error about too many open files.
Error:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/lib/python3.10/site-packages/gpiod/__init__.py", line 48, in find_line
  File "/usr/lib/python3.10/site-packages/gpiod/libgpiodcxx/__init__.py", line 1285, in __iter__
  File "/usr/lib/python3.10/site-packages/gpiod/libgpiod/__init__.py", line 1195, in __iter__
  File "/usr/lib/python3.10/site-packages/gpiod/libgpiod/__init__.py", line 118, in gpiod_chip_open
  File "/usr/lib/python3.10/site-packages/gpiod/libgpiod/__init__.py", line 89, in _is_gpiochip_cdev
OSError: [Errno 24] Too many open files: '/sys/bus/gpio/devices/gpiochip0/dev'

Potential reason is that find_line doesn't properly close file descriptors when going through the chips. Can not reproduce on gpiochip0 or when trying to find a pin that doesn't exists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL