livekit / agents

Build real-time multimodal AI applications 🤖🎙️📹
https://docs.livekit.io/agents
Apache License 2.0
3.91k stars 395 forks source link

Joining one participant to the room resulted in receiving two job requests when using JobType.JT_PUBLISHER #681

Closed xiaoxiper closed 2 weeks ago

xiaoxiper commented 2 months ago

Hello, when I set the mode to JobType.JT_PUBLISHER, after 1 human user joined the room and two agents were started, I found that the agent service received 2 job requests. I'm using the cloud version of LiveKit. https://cloud.livekit.io/

The relevant logs are as follows:

The first time

2024-08-28 10:40:24,789 - INFO livekit.agents - received job request {"job_request": "id: \"AJ_BnKiGVqbSwmv\"\ntype: JT_PUBLISHER\nroom {\n  sid: \"RM_z8MKAce5KP3r\"\n  name: \"my-room\"\n  empty_timeout: 300\n  creation_time: 1724812820\n  enabled_codecs {\n    mime: \"video/H264\"\n  }\n  enabled_codecs {\n    mime: \"video/VP8\"\n  }\n  enabled_codecs {\n    mime: \"video/VP9\"\n  }\n  enabled_codecs {\n    mime: \"video/AV1\"\n  }\n  enabled_codecs {\n    mime: \"audio/red\"\n  }\n  enabled_codecs {\n    mime: \"audio/opus\"\n  }\n  version {\n    unix_micro: 1724812820307984\n  }\n  departure_timeout: 20\n}\nparticipant {\n  sid: \"PA_zsEsghxyD37t\"\n  identity: \"identity_8f5d0634-aade-449b-a174-1dc1daff8514\"\n  state: ACTIVE\n  tracks {\n    sid: \"TR_AMvDELgCWEaMSQ\"\n    source: MICROPHONE\n    mime_type: \"audio/red\"\n    mid: \"1\"\n    stream: \"camera\"\n    version {\n      unix_micro: 1724812824346834\n    }\n    audio_features: TF_ECHO_CANCELLATION\n    audio_features: TF_NOISE_SUPPRESSION\n    audio_features: TF_AUTO_GAIN_CONTROL\n  }\n  joined_at: 1724812820\n  name: \"human_user\"\n  version: 4\n  permission {\n    can_subscribe: true\n    can_publish: true\n    can_publish_data: true\n    can_update_metadata: true\n  }\n  region: \"otokyo1a\"\n  is_publisher: true\n}\nnamespace: \"default\"\nstate {\n  updated_at: 1724812824850955020\n}\n", "resuming": false}
2024-08-28 10:40:24,800 - INFO livekit.agents.job - Accepting job AJ_BnKiGVqbSwmv as agent-AJ_BnKiGVqbSwmv

The second time the job request was received, it appears to be for the same room, participant and tracks: participant {\n sid: \"PA_zsEsghxyD37t\"\n identity: \"identity_8f5d0634-aade-449b-a174-1dc1daff8514\"\n state: ACTIVE\n tracks {\n sid: \"TR_AMvDELgCWEaMSQ\", but with a different job ID: AJ_Viz3xTeNSgpP. This could indicate that the LiveKit server is sending duplicate job requests for the same participant joining the room.

2024-08-28 10:40:26,498 - INFO livekit.agents - received job request {"job_request": "id: \"AJ_Viz3xTeNSgpP\"\ntype: JT_PUBLISHER\nroom {\n  sid: \"RM_z8MKAce5KP3r\"\n  name: \"my-room\"\n  empty_timeout: 300\n  creation_time: 1724812820\n  enabled_codecs {\n    mime: \"video/H264\"\n  }\n  enabled_codecs {\n    mime: \"video/VP8\"\n  }\n  enabled_codecs {\n    mime: \"video/VP9\"\n  }\n  enabled_codecs {\n    mime: \"video/AV1\"\n  }\n  enabled_codecs {\n    mime: \"audio/red\"\n  }\n  enabled_codecs {\n    mime: \"audio/opus\"\n  }\n  version {\n    unix_micro: 1724812820307984\n  }\n  departure_timeout: 20\n}\nparticipant {\n  sid: \"PA_zsEsghxyD37t\"\n  identity: \"identity_8f5d0634-aade-449b-a174-1dc1daff8514\"\n  state: ACTIVE\n  tracks {\n    sid: \"TR_AMvDELgCWEaMSQ\"\n    source: MICROPHONE\n    mime_type: \"audio/red\"\n    mid: \"1\"\n    stream: \"camera\"\n    version {\n      unix_micro: 1724812824346834\n    }\n    audio_features: TF_ECHO_CANCELLATION\n    audio_features: TF_NOISE_SUPPRESSION\n    audio_features: TF_AUTO_GAIN_CONTROL\n  }\n  joined_at: 1724812820\n  name: \"human_user\"\n  version: 4\n  permission {\n    can_subscribe: true\n    can_publish: true\n    can_publish_data: true\n    can_update_metadata: true\n  }\n  region: \"otokyo1a\"\n  is_publisher: true\n}\nnamespace: \"default\"\nstate {\n  updated_at: 1724812826563237095\n}\n", "resuming": false}
2024-08-28 10:40:26,499 - INFO livekit.agents.job - Accepting job AJ_Viz3xTeNSgpP as agent-AJ_Viz3xTeNSgpP

Thanks

keepingitneil commented 1 month ago

This is a known bug on our backend and is being worked on

davidzhao commented 2 weeks ago

this is now resolved with a server-side change