Skip to content

Do not UNLISTEN while disconnected#785

Merged
josevalim merged 2 commits into
elixir-ecto:masterfrom
Snehil-Shah:fix-unlisten
Jul 25, 2026
Merged

Do not UNLISTEN while disconnected#785
josevalim merged 2 commits into
elixir-ecto:masterfrom
Snehil-Shah:fix-unlisten

Conversation

@Snehil-Shah

Copy link
Copy Markdown
Contributor

We send the UNLISTEN query unconditionally when removing the last subscriber, which can crash the process if there is no DB connection to receive it. Similar to how we have a safety mechanism for queuing LISTEN queries, I think we can have a simple guard that ignores UNLISTEN if the connection doesn't exist anymore.

Snehil-Shah and others added 2 commits July 25, 2026 02:11
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Removed Process.flag(:trap_exit, true) from multiple tests to simplify the connection handling.
@josevalim
josevalim merged commit 981dbf4 into elixir-ecto:master Jul 25, 2026
13 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@Snehil-Shah
Snehil-Shah deleted the fix-unlisten branch July 25, 2026 08:18
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