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

Process of the client hangs in the task manager after closing #2274

Closed
Marc-Spector opened this issue Jun 13, 2021 · 9 comments
Closed

Process of the client hangs in the task manager after closing #2274

Marc-Spector opened this issue Jun 13, 2021 · 9 comments
Labels

Comments

@Marc-Spector
Copy link
Collaborator

The client does not close completely for unknown reasons. The process hangs in the task manager. Because of which it is impossible to start the client next time. To resolve this problem, need to kill the process before running the client

image

@Marc-Spector
Copy link
Collaborator Author

And the memory is gradually reduced to 3 megabytes

@Marc-Spector
Copy link
Collaborator Author

image

@Sheikah45 Sheikah45 added this to the 2021.10.0 milestone Oct 19, 2021
@Marc-Spector
Copy link
Collaborator Author

The issue has not yet been resolved.
image

@Marc-Spector Marc-Spector reopened this Nov 26, 2021
@Sheikah45 Sheikah45 removed this from the 2021.10.0 milestone Dec 10, 2021
@Marc-Spector
Copy link
Collaborator Author

It happened again. I attached the log.

.............
2022-02-09 15:44:12.365  WARN 5516 --- [JavaFX Application Thread] javafx                                   : Loading FXML document with JavaFX API of version 16 by JavaFX runtime of version 15.0.1
2022-02-09 15:47:23.329  INFO 5516 --- [pool-3-thread-11] c.f.c.patch.GameBinariesUpdateTaskImpl   : Updating binaries to 3731
2022-02-09 15:47:24.315  INFO 5516 --- [Thread-182] c.f.client.fa.relay.ice.IceAdapterImpl   : Starting ICE adapter with command: [d:\_games\faf client\jre\bin\java.exe, -jar, D:\_GAMES\FAF Client\natives\faf-ice-adapter.jar, --id, 352305, --login, MarcSpector, --rpc-port, 61309, --gpgnet-port, 56420]
2022-02-09 15:47:26.464  INFO 5516 --- [Thread-182] c.f.client.fa.ForgedAllianceService      : Starting Forged Alliance with command: [C:\ProgramData\FAForever\bin\FAFDebugger.exe, C:\ProgramData\FAForever\bin\ForgedAlliance.exe, /init, init.lua, /nobugreport, /log, %USER_PROFILE%\AppData\Roaming\Forged Alliance Forever\logs\game_16325885.log, /gpgnet, 127.0.0.1:56420, /mean, 1894.21, /deviation, 94.1349, /savereplay, gpgnet://127.0.0.1:55526/16325885/MarcSpector.SCFAreplay, /country, RU, /numgames, 1556, /numgames, 1450] in directory: C:\ProgramData\FAForever\bin
2022-02-09 15:55:39.256  INFO 5516 --- [Thread-182] c.f.client.fa.relay.ice.IceAdapterImpl   : ICE adapter terminated normally
2022-02-09 15:55:40.335  INFO 5516 --- [ForkJoinPool.commonPool-worker-5] com.faforever.client.game.GameService    : Forged Alliance terminated with exit code 0
2022-02-09 15:55:43.458  INFO 5516 --- [JavaFX Application Thread] com.faforever.client.game.GameService    : Joining game: 'All Welcome' (16325913)
2022-02-09 15:55:44.722  INFO 5516 --- [pool-3-thread-13] c.f.c.patch.GameBinariesUpdateTaskImpl   : Updating binaries to 3731
2022-02-09 15:55:44.803  INFO 5516 --- [Thread-277] c.f.client.fa.relay.ice.IceAdapterImpl   : Starting ICE adapter with command: [d:\_games\faf client\jre\bin\java.exe, -jar, D:\_GAMES\FAF Client\natives\faf-ice-adapter.jar, --id, 352305, --login, MarcSpector, --rpc-port, 18186, --gpgnet-port, 24725]
2022-02-09 15:55:46.842  INFO 5516 --- [Thread-277] c.f.client.fa.ForgedAllianceService      : Starting Forged Alliance with command: [C:\ProgramData\FAForever\bin\FAFDebugger.exe, C:\ProgramData\FAForever\bin\ForgedAlliance.exe, /init, init.lua, /nobugreport, /log, %USER_PROFILE%\AppData\Roaming\Forged Alliance Forever\logs\game_16325913.log, /gpgnet, 127.0.0.1:24725, /mean, 1894.21, /deviation, 94.1349, /savereplay, gpgnet://127.0.0.1:54206/16325913/MarcSpector.SCFAreplay, /country, RU, /numgames, 1556, /numgames, 1450] in directory: C:\ProgramData\FAForever\bin
2022-02-09 16:30:47.052  WARN 5516 --- [Thread-276] c.f.commons.replay.VictoryCondition      : Unknown victory condition: null
2022-02-09 16:30:47.057  INFO 5516 --- [Thread-276] c.f.client.replay.ReplayFileWriterImpl   : Writing replay file to C:\ProgramData\FAForever\replays\16325913-MarcSpector.fafreplay (1.4 MiB)
2022-02-09 16:30:53.656  INFO 5516 --- [Thread-277] c.f.client.fa.relay.ice.IceAdapterImpl   : ICE adapter terminated normally
2022-02-09 16:30:55.788  INFO 5516 --- [ForkJoinPool.commonPool-worker-3] com.faforever.client.game.GameService    : Forged Alliance terminated with exit code 0
2022-02-09 16:41:35.182  WARN 5516 --- [JavaFX Application Thread] c.f.client.fa.relay.ice.IceAdapterImpl   : Ignoring call to ICE adapter as we are not connected: quit([])
2022-02-09 16:41:35.189  INFO 5516 --- [JavaFX Application Thread] c.f.c.map.generator.MapGeneratorService  : Deleting leftover generated maps...
2022-02-09 16:41:35.294  INFO 5516 --- [JavaFX Application Thread] c.f.client.remote.FafServerAccessor      : Closing lobby server connection
2022-02-09 16:41:35.295  INFO 5516 --- [JavaFX Application Thread] com.faforever.commons.lobby.FafLobbyApi  : Disconnecting from server
2022-02-09 16:41:35.297  INFO 5516 --- [JavaFX Application Thread] com.faforever.commons.lobby.FafLobbyApi  : Outbound channel closed
2022-02-09 16:41:35.321  INFO 5516 --- [reactor-tcp-nio-2] com.faforever.commons.lobby.FafLobbyApi  : Disconnected from server
2022-02-09 16:41:37.364  INFO 5516 --- [JavaFX Application Thread] com.faforever.client.config.AsyncConfig  : Shutting down ExecutorService 'taskExecutor'

It looks like something happened with the replay recording. I assume that the Thread-276 is frozen, if we judge that the size of the replay (1.4 MiB) specified in the log does not match the current ones

image

@Brutus5000
Copy link
Member

@Sheikah45 Just calling Platform.exit() is not sufficient. See https://stackoverflow.com/questions/14938279/javafx-application-still-running-after-close?rq=1 for discussion.
Also the Spring application context is not properly closed this way (it's just a JavaFX call). Article for closing a Spring app: https://www.baeldung.com/spring-boot-shutdown

@Sheikah45
Copy link
Member

The application has an implemented stop method which closes the applicationContexts as well as checking each thread.
So that is already done and calling platform.exit calls this method.

See

public void stop() throws Exception {
    applicationContext.close();
    super.stop();

    Thread timeoutThread = new Thread(() -> {
      try {
        Thread.sleep(Duration.ofSeconds(10).toMillis());
      } catch (InterruptedException ignored) {
      }

      Set<Entry<Thread, StackTraceElement[]>> threads = Thread.getAllStackTraces().entrySet();

      if (threads.stream().allMatch(t -> t.getKey().isDaemon())) {
        return;
      }

      threads.stream()
          .filter(e -> !e.getKey().isDaemon())
          .forEach(e -> {
            log.error("Non daemon Thread \"{}\" (id: {}) still active in state: {}", e.getKey().getName(), e.getKey().getId(), e.getKey().getState());
            log.error("Stacktrace of thread {}:\n{}", e.getKey().getName(), Arrays.stream(e.getValue()).map(Object::toString).collect(Collectors.joining("\n")));
          });

      try {
        Thread.sleep(Duration.ofSeconds(1).toMillis());
      } catch (InterruptedException ignored) {
      }

      System.exit(-1);
    });
    timeoutThread.setDaemon(true);
    timeoutThread.start();
  }

@Brutus5000
Copy link
Member

Looks like we need some more logging to see if this is actually called

@Sheikah45
Copy link
Member

Sheikah45 commented Feb 13, 2022

Yes although I do know it is actually called because previously there were occasionally errors during shutdown due to the order the beans were destroyed in.

See #2552

mrchris2000 pushed a commit to mrchris2000/downlords-faf-client that referenced this issue Apr 15, 2022
@Marc-Spector
Copy link
Collaborator Author

The issue no longer bothers me for the last six months. Perhaps some update fixed this issue. I am closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants