FriendsOfGalaxy/galaxy-integration-epic

Epic store plugin consistently "crashes" in start_local_size_import

Closed this issue · 10 comments

Describe the bug
The plugin consistently "crashes" after galaxy starts. This error is reproducible with differing accounts on different systems since both my friend and I are having the issue. During the start_local_size_import method, an error is reported and "crashes" when many games are installed on a given computer.

To Reproduce
Steps to reproduce the behavior, for example:

  1. Install piles of games to your computer with epic. (This may require multiple drives to reproduce error for your setup. The computer with the least games installed was 409 GB from the epic store. You can get about 75% of this with the free ark editor if you don't have enough games.)
  2. Wait ~7 minutes after the plugin is enabled and is still chugging. (It will always crash at the exact same spot assuming more games are not installed, even after restarting. This really seems to look like this is for a timeout of start_local_size_import to trigger galaxy to detect a "crash"; since the two systems affected do not have the same games installed nor are they using the same accounts.)
  3. See that plugin has "crashed".

Expected behavior
The plugin should not crash and should continue to run if there is no issue.

Attached logs
plugin-epic-24d5f405-7211-4198-83c4-50a6f63b1dcf.log
GalaxyClient.log

Highlights:

  • GalaxyClient.log

2020-06-03 14:56:36.658 [Warning][ (0)] [TID 17876][galaxy_client]: Failed to start importing game local sizes for platform 'epic', reason 'ImportInProgress'.
2020-06-03 14:56:36.658 [Warning][ (0)] [TID 17876][galaxy_client]: Failed to start importing game local sizes for platform 'epic', reason 'ImportInProgress'.
2020-06-03 14:56:36.658 [Information][ (0)] [TID 17876][galaxy_client]: All local game sizes received from plugin.
2020-06-03 14:56:36.658 [Information][ (0)] [TID 17876][galaxy_client]: Finished importing external local sizes for platform 'epic'.
2020-06-03 14:56:36.658 [Warning][ (0)] [TID 17876][galaxy_client]: Failed to start importing game local sizes for platform 'epic', reason 'ImportInProgress'.
2020-06-03 14:56:36.691 [Fatal][ (0)] [TID 7440][galaxy_client]: Unhandled exception 'Unrecognised conversion of the strong enumeration type GameDataChangedReason(23) to its weak type mapping.' during timer execution.
2020-06-03 14:56:36.691 [Information][ (0)] [TID 7440][galaxy_client]: Discarding problem report because 421s elapsed since last sending of Exception-During-Service-Calls problem.

2020-06-03 14:57:50.653 [Warning][ (0)] [TID 17876][galaxy_client]: Failed to start importing game local sizes for platform 'epic', reason 'UnknownError'.
2020-06-03 14:57:50.957 [Information][ (0)] [TID 7440][galaxy_client]: Scheduling providing 'Games' statistics.
2020-06-03 14:57:50.958 [Information][ (0)] [TID 7440][galaxy_client]: Scheduling providing 'Achievements 'statistics.
2020-06-03 14:57:50.958 [Information][ (0)] [TID 7440][galaxy_client]: Scheduling providing 'GameTimes' statistics.
2020-06-03 14:57:51.066 [Information][ (0)] [TID 7440][galaxy_client]: Retrieved friends' recent play sessions for user 46989125492030361.
2020-06-03 14:57:51.066 [Information][ (0)] [TID 7440][galaxy_client]: 'Games' statistics successfully gathered.
2020-06-03 14:57:51.463 [Information][ (0)] [TID 20100][galaxy_client]: Fetching Achievements statistics for 12 connected platform(s): steam, xboxone, psn, origin, uplay, battlenet, epic, humble, gw2, twitch, test, gog.
2020-06-03 14:57:51.817 [Information][ (0)] [TID 17876][galaxy_client]: Received onPluginShutdownFailure for plugin pluginID/epic_24d5f405-7211-4198-83c4-50a6f63b1dcf
2020-06-03 14:57:51.817 [Warning][ (0)] [TID 17876][galaxy_client]: Plugin pluginID/epic_24d5f405-7211-4198-83c4-50a6f63b1dcf shutdown failed, killing process
2020-06-03 14:57:51.817 [Error][ (0)] [TID 17876][galaxy_client]: Plugin - pluginID/epic_24d5f405-7211-4198-83c4-50a6f63b1dcf has crashed.

  • plugin-epic-24d5f405-7211-4198-83c4-50a6f63b1dcf.log

2020-06-03 14:56:36,623 - galaxy.api.jsonrpc - INFO - Sending notification: method=local_size_import_finished, params=None
2020-06-03 14:56:36,623 - galaxy.api.jsonrpc - DEBUG - Sending 75 bytes of data
2020-06-03 14:56:36,623 - galaxy.task_manager - DEBUG - Task manager plugin external: finished task 945 (local size import)
2020-06-03 14:56:36,624 - root - DEBUG - Sending data: {"jsonrpc": "2.0", "id": "762", "error": {"code": 600, "message": "Import already in progress"}}
2020-06-03 14:56:36,624 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: finished task 740 (start_local_size_import)
2020-06-03 14:56:36,624 - galaxy.api.jsonrpc - DEBUG - Received 99 bytes of data
2020-06-03 14:56:36,624 - galaxy.api.jsonrpc - INFO - Handling request: id=763, method=start_local_size_import, params={'game_ids': ['ARKDevKit']}
2020-06-03 14:56:36,624 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 741 (start_local_size_import)
2020-06-03 14:56:36,628 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 949 (start_local_size_import)
2020-06-03 14:56:36,629 - galaxy.api.jsonrpc - DEBUG - Received 98 bytes of data
2020-06-03 14:56:36,629 - galaxy.api.jsonrpc - INFO - Handling request: id=764, method=start_local_size_import, params={'game_ids': ['Albacore']}
2020-06-03 14:56:36,629 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 742 (start_local_size_import)
2020-06-03 14:56:36,630 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 950 (local size import)
2020-06-03 14:56:36,630 - galaxy.task_manager - DEBUG - Task manager plugin external: finished task 949 (start_local_size_import)
2020-06-03 14:56:36,630 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 951 (start_local_size_import)
2020-06-03 14:56:36,630 - galaxy.api.jsonrpc - DEBUG - Received 96 bytes of data
2020-06-03 14:56:36,630 - galaxy.api.jsonrpc - INFO - Handling request: id=765, method=start_local_size_import, params={'game_ids': ['Almond']}
2020-06-03 14:56:36,630 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 743 (start_local_size_import)
2020-06-03 14:56:36,631 - root - DEBUG - Sending data: {"jsonrpc": "2.0", "id": "763", "result": null}
2020-06-03 14:56:36,631 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: finished task 741 (start_local_size_import)
2020-06-03 14:56:36,631 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 952 (start_local_size_import)
2020-06-03 14:56:36,631 - galaxy.api.jsonrpc - DEBUG - Received 98 bytes of data
2020-06-03 14:56:36,631 - galaxy.api.jsonrpc - INFO - Handling request: id=766, method=start_local_size_import, params={'game_ids': ['Amaranth']}
2020-06-03 14:56:36,631 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 744 (start_local_size_import)
2020-06-03 14:56:36,631 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 744 (start_local_size_import)

Oh. That's what starts chewing my HDD once a hour +/-.
Having same issue then. I have only 1 game (Civ VI with a number of DLCs) installed though - but the library is... big enough.
In some cases (once a day +/-) something tries to relaunch the plugin automatically - and it may stuck in connecting state too.

My plugin is frequently crashing as well. Sometimes gets hung on "Connecting" when I relaunch it.
plugin-epic-24d5f405-7211-4198-83c4-50a6f63b1dcf.log

Same issue here with "only" 56 games in the epic library. It started a couple of weeks ago.

Same here in fact exactly the same as @patho5 sometimes its hung on connecting

get_local_size disable for now until Galaxy uses it 867b75e
Crashes were caused by blocking code bug, I'm sorry for that.
Performance of this function in the future should be partially up to Galaxy

If this feature was to remain implemented, then it would probably have to be running on another thread to make sure that the main api called by galaxy was still responsive within the timeout allowed and not determined to be dead. I had to run these types of "expensive" operations on another thread, cache the result for the main thread and throw updates back to galaxy when I noticed that things changed.

@AndrewDWhite good point, we may use threads. But it is also enough to make it asynchronous as it is already done in above change as well (async stop after stating each file).

and throw updates back to galaxy when I noticed that things changed.

API exposes request-response model in that case. But yes - caching values is definitely a way to go if Galaxy asks for local sizes too often, but the problem is: how to know that something has changed without stating every file again?

I would wait until Galaxy implements using local size's.

I know that most games' sizes can be seen in Programs & Features. I'm not sure, but if there is a way of accessing that information that would be much better doing it manually.

The best solution I can think of is to subscribe to directory change notifications. I would have to look into the python way of doing this.
https://docs.microsoft.com/en-us/windows/win32/fileio/obtaining-directory-change-notifications