node-metaverse icon indicating copy to clipboard operation
node-metaverse copied to clipboard

Inconsistent Packet Parsing for Avatar / Region Appearance Due to Aggressive Timeouts Issues

Open ceriumdynamics opened this issue 11 months ago • 1 comments

Encountering persistent packet parsing errors during avatar appearance loads. The system logs the following warning:

WARNING: Finished reading AvatarAppearance but we're not at the end of the packet (pos < buf.length, seq XYZ)

This warning indicates that the packet parser in Packet.readFromBuffer does not consume the entire buffer, resulting in incomplete data processing.

Suspected Root Causes:

The core system currently enforces a 10-sec timeout for requests. In addition, the resend timeout for reliable packets is set to 1000ms and file transfer timeouts are set to 10000ms in the Circuit class. These values may be too low in environments with high latency or variable network conditions, causing partial packet reception and premature parsing.

The waitForAck mechanism, which also relies on these timeout settings, might be triggering too early, resulting in missed acknowledgments.

Steps to Reproduce:

  1. Run the application under simulated or realworld conditions with variable or poor connectivity or busy sim.
  2. Initiate the avatar appearance load process.
  3. Monitor console logs for the warning about incomplete packet processing
  4. Observe that issue is intermittent and correlates with network delay.

Expected Behavior:

  1. The system should wait not even long enough to receive complete packets before processing.
  2. Adjusting timeouts to longer durations (e.g. 30-60 sec for general requests, and possibly up to 300 sec for some file transfers) should reduce or eliminate these errors.

Environment:

Node.js Version: 20 node-metaverse Commit/Version: 64359a3418b2c783a3308f238d9d3dc22340d95c Operating System: Docker Alpine-amd64 / Docker Alpine-arm64

Proposed Solutions

Increase Timeout Values: Modify the timeout durations in the Circuit class (eg. increase the resend timeout and file transfer timeouts), make sure that waitForAck in it's place.

ceriumdynamics avatar Mar 09 '25 23:03 ceriumdynamics

No it's just because the message has been extended since the version of the message template that the library uses, so there's additional data that we don't recognise.

It's harmless and can be ignored.

To fix the message the packet classes need to be updated, but we don't currently support bailing out early so it will kill support for opensim.

I'm working on a refactor to improve this but for the moment, it's fine to ignore this warning

Lokomojo avatar Mar 12 '25 18:03 Lokomojo