Skip to content

Conversation

@TamaraFinogina
Copy link
Collaborator

@TamaraFinogina TamaraFinogina commented Jan 29, 2026

Description

When the connection fails due to a server or WebSocket error, several instances of web workers are created.
Screenshot 2026-01-28 at 16 19 59

If the conference fails, it should clean up web workers, too

How Has This Been Tested?

During a call, switch from wi-fi to mobile internet to cause webSocket closed error. Or test when server is busy and terminates connections

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@TamaraFinogina TamaraFinogina self-assigned this Jan 29, 2026
@TamaraFinogina TamaraFinogina changed the title [PB-5724] Dispose of webworkers [PB-5724] Cleanup the webworkers Jan 29, 2026
Comment on lines 868 to 908
dispose() {
this._olmAdapter.clearMySession();
this.clearAllSessions();
this.conference.off(
JitsiConferenceEvents.USER_JOINED,
this._onParticipantJoined.bind(this),
);
this.conference.off(
JitsiConferenceEvents.USER_LEFT,
this._onParticipantLeft.bind(this),
);
this.conference.off(
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._onEndpointMessageReceived.bind(this),
);
this.conference.off(
JitsiConferenceEvents.CONFERENCE_LEFT,
this._onConferenceLeft.bind(this),
);
this.conference.off(JitsiConferenceEvents.CONFERENCE_JOINED, this.onConferenceJoined.bind(this));
this.conference.off(
JitsiConferenceEvents._MEDIA_SESSION_STARTED,
this._onMediaSessionStarted.bind(this),
);
this.conference.off(
JitsiConferenceEvents.TRACK_ADDED,
this.onTrackAddedHandler.bind(this),
);
this.conference.rtc.off(
RTCEvents.REMOTE_TRACK_ADDED,
this.onRemoteTrackAddedHandler.bind(this),
);
this.conference.off(
JitsiConferenceEvents.TRACK_MUTE_CHANGED,
this._trackMuteChanged.bind(this),
);
this.e2eeCtx.off('sasUpdated', this.sasUpdatedHandler);
this.e2eeCtx.dispose();
this._reqs.clear();
this.update.clear();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dispose() listener removal won't work due to .bind(this) creating new function references.

EventEmitter.removeListener() compares by reference. Each .bind(this) call creates a new function object, so the references passed to off() in dispose() don't match the ones registered with on() in the constructor and the listeners silently remain attached

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, ok. Do you know how to remove .bind(this) listeners?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create and keep reference in the class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@TamaraFinogina TamaraFinogina changed the base branch from master to new_version February 10, 2026 16:48
@TamaraFinogina TamaraFinogina merged commit f076012 into new_version Feb 10, 2026
3 checks passed
@TamaraFinogina TamaraFinogina deleted the cleanup_webworkers branch February 10, 2026 16:51
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

Successfully merging this pull request may close these issues.

2 participants