Skip to content

Error updating all mods (listAllMods npe) #288

@knoxfighter

Description

@knoxfighter

I noticed an error message popping up, when updating all mods (had 5 to update). The first three went through without any problems the other 2 had error messages showing up.

Log of that happening: https://pastebin.com/ymrQS7cW

My guess: A racecondition i when running the filepath walker. It creates a list of all the files internally, but when our code is called, that file already got deleted by another coroutine.
Possible solutions:

  • Check info and filePath for nil (if they are nil at this point, they could also lead to invalid data)
  • Rewriting how updating all mods work (the preffered way, cause the current implementation was only a temporary solution)
    Additionally i would recommend, that removing that race-condition at all would be great (handle file watching and more by ourselves), or any other way you can think of.

To describe my guessed race condition:

  • Multiple update calls are done simultaniously
  • Downloading new mod 1
  • Downloading new mod 2
  • Saving new mod 1
  • Saving new mod 2
  • Delete old mod 1
  • List all mods in mod 1
  • Delete old mod 2
  • List all mods in mod 2
  • Iterate over all files in mod 1
  • Crash, cause the file for old mod 2 is not there anymore

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions