dh4 / mupen64plus-qt

A customizable launcher for Mupen64Plus
BSD 3-Clause "New" or "Revised" License
95 stars 10 forks source link

GLib-ERROR **: Creating pipes for GWakeup: Too many open files Trace/breakpoint trap #62

Open eduardomozart opened 3 years ago

eduardomozart commented 3 years ago

I'm using the latest build from Mupen64plus-qt (1.14-git:cb46228) into Deepin 20.2.3 (based on Debian 10 "Buster" amd64). I started scanning my ROMs (946 ROMs) with the "Download Game Information (thegamesdb.net)" option checked and into the 586 ROM the program crashes with the following error message:

$ ./mupen64plus-qt
(process:1526): GLib-ERROR **: 12:39:37.842: Creating pipes for GWakeup: Too many open files
Trace/breakpoint trap

The final result is that there's 586 games into the Mupen64plus-qt instead of 946 ROMs.

It happens only when the option "Download Game Information (thegamesdb.net)" option is checked - it scan all the 946 ROMs files when this option is unchecked. I'm not sure, but I believe it's happening because Mupen64plus-qt process is opening too much files at once - maybe it's not closing the file handlers from the last scanned ROMs and cover arts? I didn't dig into the source code, so I'm not sure if these are the issue.

If I can run some command or tests to troubleshoot this issue, please let me know. Maybe these commands output may help:

$ cat /proc/sys/fs/file-max
9223372036854775807
$ ulimit -Hn
1048576
$ ulimit -Sn
1024
$ sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 62812

The following command (file descriptor that contains an entry for each file the process has open) is always increasing it's value:

$ ls -la  /proc/$(pidof mupen64plus-qt)/fd | wc -l
1008
$ ls -la  /proc/$(pidof mupen64plus-qt)/fd | wc -l
1009

It hangs about when this number is near to ''1024'' files descriptors opened. I believe it hangs when it reaches the "soft" limit (''ulimit -Sn'').

This error do not happens when I scan my ROM library for the second time after it hangs. I believe that it happens because there already is information into the cache_v2 folder (/home/leo/.local/share/mupen64plus-qt/cache_v2) so a file handler isn't opened for already downloaded information ROMs, so all 946 ROMs are showed into the program and it's information is all downloaded from TheGameDB.

dh4 commented 3 years ago

Just a cursory look through the source code and I didn't find any file objects it's leaving open. I'll have to take a deeper look into this to find out why it's occurring when I get a chance. Thanks for reporting this.