Skip to content

Unable to read files from asar after 10+ hours of runtime #27982

Closed

Description

@zarubond

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    11.2.3, 11.2.3, 11.3.0
  • Operating System:
    Windows 10
  • Last Known Working Electron version:
    8.5.5

Expected Behavior

Electron should correctly load resource from asar with file protocol.

Actual Behavior

After some runtime any file you try to load from asar fails to load with net::ERR_FILE_NOT_FOUND

To Reproduce

Run the Electron for 10+ hours and from time to time try to read file from asar. After some time will start getting errors net::ERR_FILE_NOT_FOUND on all files.

Screenshots

Additional Information

Activity

  1. MarshallOfSound commented on Mar 4, 2021

    @MarshallOfSound
    Member

    Thank you for taking the time to report this issue and helping to make Electron better.

    Please provide a standalone test that a tester could run to reproduce the issue. This makes fixing issues go more smoothly: not only does it ensure the right thing is tested, but it also prevents triage from bottlenecking on making testers write new tests for each new issue.

    I'm setting the more-information-needed label for the above reasons. After you've responded, please @ me in a followup comment.

    Thanks in advance! Your help is appreciated.

  2. added
    blocked/need-repro
    on Mar 4, 2021
  3. changed the title [-]Resources from asar are not loaded in child window[/-] [+]Unable to read files from asar after 10+ hours of runtime[/+] on Mar 5, 2021
  4. giancarlokc commented on Mar 9, 2021

    @giancarlokc

    We started to see something similar on our electron app (v11). The issue seems to happen after running the app for a few minutes. We are working on a electron-quickstart reproduction.

  5. zarubond commented on Mar 10, 2021

    @zarubond
    ContributorAuthor

    @MarshallOfSound @ckerr I have been debugging the code on Window with 32bit Electron and here is what I found:

    The problem happens in https://github.com/electron/electron/blob/11-x-y/shell/common/asar/archive.cc where in the constructor Archive::Archive the method file_.Initialize returns false. The reason why it returns false is that in file https://github.com/chromium/chromium/blob/87.0.4264.1/base/files/memory_mapped_file_win.cc inside method MemoryMappedFile::MapFileRegionToMemory a Windows function ::MapViewOfFile is called and it returns NULL.

    This feature was introduced in Electron 11 with #24470 @nornagon

    My best guess is that it is failing because it runs out of memory/handlers given that I see several dozen opened file handles to the asar archive in Process Explorer. In the asar_util.cc there is a global map g_archive_map_tls which creates a new instance of Archive for every thread, which seems to be happening quite often from what I have seen in debugger. Since content of that map is never released, at some point Windows probably just refuses to allocate more resources.

    You can test this problem with Skype insiders on Windows https://www.skype.com/en/insider/ . You just need to log in, let it run for about 10hours, and then you can observe in settings menu that icons are missing which is a sign that Skype is not able to load them from asar. Unfortunately Skype is using private build of Electron so public symbols will not work, but I can send you correct one of you are Microsoft employee.

  6. stewartlord commented on Mar 11, 2021

    @stewartlord
    Contributor

    @zarubond Nice work! We've started to zero in on that mmap code as well. For what it's worth we are only seeing the issue on Windows builds. With our usage the problem occurs within about 10 minutes. If we can get a tight reproduction we will share it here.

  7. cschear commented on Mar 11, 2021

    @cschear

    We also just got bit by this one. You can see the javascript file failed to load after using the app for a short amount of time. Once this happens all requests for files under the asar path fail until you restart the application.

    MicrosoftTeams-image

  8. self-assigned this
    on Mar 11, 2021
  9. nornagon commented on Mar 11, 2021

    @nornagon
    Contributor

    Would love to get this fixed properly w/ mmap working, but in the meantime #28137 reverts the offending commit.

  10. knaos commented on May 19, 2021

    @knaos

    I am experiencing this problem only on 32 bit version of the app on Windows 10 32 bit. Electron version: 11.1.1

  11. stewartlord commented on May 19, 2021

    @stewartlord
    Contributor

    @knaos If you update to v11.4.1 the problem should be resolved 👍

  12. knaos commented on May 20, 2021

    @knaos

    @stewartlord Thank you! This fixes the problem!

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

Metadata

Metadata

Assignees

Labels

11-x-yblocked/need-repro

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions