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

EMFILE: 'too many open files' error when trying to read installed games list from EGS with Legendary #4293

Open
RQWorldblender opened this issue Jan 21, 2025 · 0 comments
Labels
bug:unconfirmed Someone works on identifying the issue

Comments

@RQWorldblender
Copy link

RQWorldblender commented Jan 21, 2025

Describe the bug

When the library is unable to successfully refresh (and during a refresh), no games can be launched. It arises from a 'too many open files' issue, in which the Heroic backend may be opening too many files at once if the open files limit is set too low. It also causes the 'Wine Manager', 'System Information', and part of the 'Logs' pages to become unusable as they endlessly load. As Legendary is set up to update the games list by default, this behavior can be triggered as soon as Heroic is opened, even if trying to launch a game from a menu entry or desktop shortcut. Once 'too many open files' happens, the Heroic backend will get stuck trying to refresh the games list, games unable to be launched, even those already installed, as handlers are unable to be registered.

This 'too many open files' issue can occur across various Electron (and maybe Chromium) based programs.

Add logs

(21:17:59) ERROR:   [Backend]:          Error: EMFILE: too many open files, watch '/home/richard/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary/installed.json'
    at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
    at Object.watch (node:fs:2491:36)
    at Module.<anonymous> (/app/bin/heroic/resources/app.asar/build/main/main.js:184:6514)
    at Module._compile (node:internal/modules/cjs/loader:1373:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at Function.c._load (node:electron/js2c/node_init:2:17025)
    at node:electron/js2c/browser_init:2:126921
    at node:electron/js2c/browser_init:2:127130 {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  path: '/home/richard/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary/installed.json',
  filename: '/home/richard/.var/app/com.heroicgameslauncher.hgl/config/heroic/legendaryConfig/legendary/installed.json'
}
(21:17:59) ERROR:   [Backend]:          Failed to fetch system information Error: Attempted to register a second handler for 'getLogContent'
    at IpcMainImpl.handle (node:electron/js2c/browser_init:2:101512)
    at Module.<anonymous> (/app/bin/heroic/resources/app.asar/build/main/main.js:182:18708)
    at Module._compile (node:internal/modules/cjs/loader:1373:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at Function.c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at Module.<anonymous> (/app/bin/heroic/resources/app.asar/build/main/chunks/linux-SjPdHrBO.js:1:128)
Error occurred in handler for 'refreshLibrary': Error: No handler registered for 'refreshLibrary'
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:83650)
    at WebContents.emit (node:events:519:28)
Error occurred in handler for 'launch': Error: No handler registered for 'launch'
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:83650)
    at WebContents.emit (node:events:519:28)

Steps to reproduce

  1. Go to 'Library' (will open up as the first page)
  2. 'Refresh' icon does not stop animating
  3. Try to navigate to either 'System Information' or 'Wine Manager', or 'Logs' pages
  4. Any of the above three pages will eventually get stuck loading with refresh animations not stopping

Expected behavior

The games library should finish updating shortly after Heroic is launched. The other affected pages should also be able to load. None of the pages should get endless stuck loading.

Screenshots

No response

Heroic Version

Latest Stable

System Information

CPU: 12x AMD Ryzen 5 5500GT with Radeon Graphics
Memory: 16.1 GB (used: 9.7 GB)
GPUs:
GPU 0:
Name: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series]
IDs: D=1638 V=1002 SD=1636 SV=1002
Driver: amdgpu
OS: Ubuntu 24.04.1 LTS (Noble Numbat) (linux)

The current system is not a Steam Deck
We are not running inside a Flatpak container

Software Versions:
Heroic: 2.15.2 Emeth
Legendary: 0.20.36 Urban Flight (Heroic)
gogdl: 1.1.2
comet: comet 0.1.2

Nile: 1.1.2 Will A. Zeppeli

This occurs whether using the Flatpak version or traditional packaged versions.

Additional information

A possible workaround is to go to the Heroic configuration files, navigate to 'legendaryConfig' -> 'legendary', then config.ini, then change the following settings to:

[Legendary]
; Disables the automatic update check
disable_update_check = true
; Disables the notice about an available update on exit
disable_update_notice = true

Changing these two settings disables checking for updates at start (for Legendary), also seemingly not running into the 'too many open files' issue, which may be useful for those that have an infrequently changing game library. These and all other settings supported by Legendary itself are unfortunately inaccessible from the Heroic GUI, which can be rather use unfriendly.

Moving or removing these config files and then restarting Heroic also works, but requires going to these configuration files every time, which can be rather user unfriendly.

I have also looked at the launch command per game from running Heroic from a terminal, and copied the command to be run directly. This means that I bypass the Heroic frontend entirely, and hence will not run into the 'too many open files' issue for as long as I don't have to update the installed games or my games library.

@RQWorldblender RQWorldblender added the bug:unconfirmed Someone works on identifying the issue label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unconfirmed Someone works on identifying the issue
Projects
None yet
Development

No branches or pull requests

1 participant