ueberdosis / hocuspocus

The CRDT Yjs WebSocket backend for conflict-free real-time collaboration in your app.
https://tiptap.dev/docs/hocuspocus/introduction
MIT License
1.21k stars 117 forks source link

Hang caused by not cleaning up Awareness in provider #769

Closed tobowers closed 8 months ago

tobowers commented 8 months ago

Description creating a new HocuspocusProvider does not allow a nodejs process to terminate due to event listeners still attached in Awareness creation.

Adding an this.awareness?.destroy() during destroy fixes the issue.

Steps to reproduce the bug Steps to reproduce the behavior: https://gist.github.com/tobowers/4746fda90322d585b1e10c1fa0d4e4b0

Expected behavior All event listeners and sockets are cleaned up during destroy and nodejs can exit.

Environment?

Additional context This is the line: https://github.com/ueberdosis/hocuspocus/blob/main/packages/provider/src/HocuspocusProvider.ts#L175

I was unable to npm install in the repo, or else I'd open a PR.

janthurau commented 8 months ago

Thanks for the report! Will be fixed in the next release (this week).