diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c2ac07356..f7853d09a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) -* None. +* Sending a QUERY message may fail with `Assertion failed: !m_unbind_message_sent` ([#5149](https://github.com/realm/realm-core/pull/5149), since v11.8.0) ### Breaking changes * None. diff --git a/src/realm/sync/client.cpp b/src/realm/sync/client.cpp index 63d265ca7ae..ffee279361b 100644 --- a/src/realm/sync/client.cpp +++ b/src/realm/sync/client.cpp @@ -724,7 +724,10 @@ void SessionImpl::on_resumed() void SessionImpl::on_new_flx_subscription_set(int64_t new_version) { - if (m_conn.get_state() == ConnectionState::connected) { + // If m_state == State::Active then we know that we haven't sent an UNBIND message and all we need to + // check is that we have completed the IDENT message handshake and have not yet received an ERROR + // message to call ensure_enlisted_to_send(). + if (m_state == State::Active && m_ident_message_sent && !m_error_message_received) { logger.trace("Requesting QUERY change message for new subscription set version %1", new_version); ensure_enlisted_to_send(); }