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

[Bug]: Add-ons with javascript assets can cause clients on the same machine connect to hang indefinitely or exception when loaded #4962

Open
fishface60 opened this issue Sep 30, 2024 · 1 comment · May be fixed by #5151
Labels

Comments

@fishface60
Copy link
Contributor

Describe the Bug

When connecting a client on the same machine I can reliably get MapTool to indefinitely wait for an asset to load.

When creating a new campaign without the add-on loaded, connecting the client, and then loading the add-on sometimes an exception is shown.

To Reproduce

  1. Download assets.zip
  2. Start MapTool
  3. Import the properties, add the add-on and drag the token onto the map.
  4. Start a server
  5. Start MapTool again
  6. Connect MapTool to the local server as a player
  7. Observe the hang

Alternatively:

  1. Start MapTool
  2. Import the properties and drag the token onto the map
  3. Start a server
  4. Start MapTool again
  5. Connect MapTool to the local server as a player
  6. Add the add-on
  7. Repeat the process until the following error is logged to console and a pop-up is shown.
19:42:36.391 (MapTool.java:298) [SocketConnection.ReceiveThread] ERROR - Error receiving game data update.
java.util.concurrent.ExecutionException: net.rptools.maptool.model.gamedata.InvalidDataOperation: Data Namespace addon: does not exist for type com.gitlab.richardmaw.mt-gurps.
        at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?]
        at net.rptools.maptool.model.gamedata.GameDataImporter.importData(GameDataImporter.java:97) ~[main/:?]
        at net.rptools.maptool.client.ClientMessageHandler.handle(ClientMessageHandler.java:449) [main/:?]
        at net.rptools.maptool.client.ClientMessageHandler.handleMessage(ClientMessageHandler.java:151) [main/:?]
        at net.rptools.clientserver.simple.connection.AbstractConnection.dispatchMessage(AbstractConnection.java:109) [clientserver.jar:?]
        at net.rptools.clientserver.simple.connection.AbstractConnection.dispatchCompressedMessage(AbstractConnection.java:115) [clientserver.jar:?]
        at net.rptools.clientserver.simple.connection.SocketConnection$ReceiveThread.run(SocketConnection.java:164) [clientserver.jar:?]
Caused by: net.rptools.maptool.model.gamedata.InvalidDataOperation: Data Namespace addon: does not exist for type com.gitlab.richardmaw.mt-gurps.
        at net.rptools.maptool.model.gamedata.InvalidDataOperation.createNamespaceDoesNotExist(InvalidDataOperation.java:110) ~[main/:?]
        at net.rptools.maptool.model.gamedata.MemoryDataStore.setData(MemoryDataStore.java:188) ~[main/:?]
        at net.rptools.maptool.model.gamedata.MemoryDataStore.lambda$setProperty$9(MemoryDataStore.java:212) ~[main/:?]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?]
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?]
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?]
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?]
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]
19:42:36.408 (I18N.java:181) [SocketConnection.ReceiveThread] DEBUG - Cannot find key 'Error receiving game data update.<br/>java.util.concurrent.ExecutionException: net.rptools.maptool.model.gamedata.InvalidDataOperation: Data Namespace addon: does not exist for type com.gitlab.richardmaw.mt-gurps.' in properties file.

Expected Behaviour

Running a second MapTool instance locally to test player client behaviour neither hangs nor displays error messages.

Screenshots

No response

MapTool Info

First observed in v1.14.3 but present in develop

Desktop

Ubuntu 24.04.1 LTS

Additional Context

Current hypothesis for the exception is that the asset raced the task for creating the add-on and the asset was loaded before the add-on was created.

@fishface60
Copy link
Contributor Author

This was determined to be caused by having an AddOn already cached when joining, so the listener callbacks were called in the AssetManager's thread pool, and that when an AddOn runs its JavaScript onInit, it gets the script using AssetManager.getAssetAsynchronously, so the AddOn's job is waiting for the script's job to complete, but the script job never starts because it's waiting for the addon job to complete.

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

Successfully merging a pull request may close this issue.

1 participant