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

localParticipant.publishData crashing server for messages longer than around 65000 bytes #384

Open
sergii-kamenskyi opened this issue Jan 10, 2025 · 0 comments

Comments

@sergii-kamenskyi
Copy link

I am using the standard function to send chat messages from the node server to the browser client.
It is part of "agent" code.

  const messageData = {
    id: message.id || crypto.randomUUID(),
    message: message.message,
    role: message.role,
    timestamp: message.timestamp || Date.now(),
  }
  const encoder = new TextEncoder()
  const data = encoder.encode(JSON.stringify(messageData))
  localParticipant.publishData(data, {
    reliable: true,
    topic: chatMessageTopic,
  })

if the data size exceeds some limit (looks like 16bit: 65535 bytes) the server crashes with timeout somewhere inside binary (rust?) code.
This limitation never stated anywhere and never checked.

I know that we should not abuse the size of the single messages, but for my use case (some technical data), the message could be up to 1mb.
Anyway, it would be nice to clarify this and make error message less obscure. (I spent days to find the reason)

The error:

[01:49:11.509] WARN (765776): process orphaned, shutting down
    jobID: "AJ_dWG4R3uvsMGr"
/home/sergii/work/zolar-assistant/node_modules/@livekit/rtc-node/src/participant.ts:141
      throw new Error(cb.error);
            ^


Error: engine: connection error: could not establish publisher connection: timeout
    at LocalParticipant.publishData (/home/sergii/work/zolar-assistant/node_modules/@livekit/rtc-node/src/participant.ts:141:13)

Node.js v22.10.0
[01:49:25.451] WARN (769111): job process exited unexpectedly
    err: {
      "type": "Error",
      "message": "Channel closed",
      "stack":
          Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
              at target.send (node:internal/child_process:753:16)
              at Timeout._onTimeout (/home/sergii/work/zolar-assistant/node_modules/@livekit/agents/dist/ipc/proc_job_executor.js:47:18)
              at listOnTimeout (node:internal/timers:594:17)
              at process.processTimers (node:internal/timers:529:7)
      "code": "ERR_IPC_CHANNEL_CLOSED"
    }

Versions:
"@livekit/agents": "^0.6.0",
"rts-node": "0.12.2",
"@livekit/rtc-node-linux-x64-gnu": "0.12.2",

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

No branches or pull requests

1 participant