aardvarkxr / aardvark

A platform for AR in VR
BSD 3-Clause "New" or "Revised" License
182 stars 20 forks source link

Networked Universii with initInfo that contain remote gadgets spawned too close to the start of a rooms gadget break in a way that causes the remote gadgets to terminate #173

Closed michaelplutovr closed 3 years ago

michaelplutovr commented 3 years ago

Scenario

Reproduction steps

Make a rooms gadget that spawns a remote universe immediately with the init info below.

{
    gadgets: [
      {
        url: "https://sophiabaldonado.github.io/mood",
        remoteLocks: [
          {
            iface: "test_panel_counter@1",
            receiver: { type: EndpointType.Unknown },
            params: { imgPath: 24 },
          },
        ],
        universeFromGadget: [
          0.03521648049354553,
          1.491823434829712,
          -1.485067367553711,
          -0.41708019375801086,
          -0.2775963246822357,
          0.8493847846984863,
          -0.16592732071876526,
        ],
        remoteGadgetId: 1,
        items: [],
      },
    ],
  };

NOTE: over the wire receiver comes thorugh as null, the EndpointType.Unknown was added to make typsecript happy and should have no affect as for remote universii initInfo gadgets the receiver is ignored.

Known oddities

  1. The below is output by the gadgets window on first render
aardvark_gadget.tsx?4bb6:301 Received interface start for N:42:1->N:30:660(aardvark-container@1)
component_moveable.ts?e7d7:250 Redrop request to replace N:30:656
aardvark_gadget.tsx?4bb6:301 Received interface start for N:42:1->N:28:27(aardvark-container@1)
component_moveable.ts?e7d7:280 got new container N:28:27 while waiting for redrop
  1. The child gadget does appear briefly and then segfaults or is terminated, unknown as logs are not available afaik

  2. If extra log statements are added to the server the remote universes gadget can be seen coming online with an endpoint address of 0 but a valid nodeId, it gets roughly 3 messages attempting to be routed to this address and then is terminated and or dies.

NOTE: at the point that all of this happens, the room gadget itself is assigned an enpoint and a node id that are valid

Open questions

fuag15 commented 3 years ago

After more investigation and help from @JoeLudwig the issue was that gadget stuff was getting rendered before the gadget had finished its initial handshake with the local server.

Modifying the rooms gadget to use waitForConnect from https://github.com/aardvarkxr/aardvark/pull/174 resolves the issue.