derekmolloy / exploringBB

Source code for the book Exploring BeagleBone, by Derek Molloy (see www.exploringbeaglebone.com)
GNU General Public License v3.0
467 stars 444 forks source link

GPIO.cpp anon_inode leak #5

Open engineeringleague opened 8 years ago

engineeringleague commented 8 years ago

Hi

I have found a issue when using the gpio.waitForEdge() method from the GPIO class. It gives me a Too many files error after the configured linux open files limit when using the method in a loop. I used lsof and detected a lot of anon_inodes. I thought this has to be a problem with epoll. It turned out that the close(epollfd) before close(fd) in waitForEdge() was missing.

Best regards Tom

bliedblad commented 7 years ago

I second the motion... I ran across this issue independently and fixed with close(epollfd). Came here to the issues tab to share my findings, but @engineeringleague beat me to it.