8000 Deadlock when calling `App::current_user` from a `User` listener · Issue #7183 · realm/realm-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Deadlock when calling App::current_user from a User listener #7183
Closed
@kraenhansen

Description

@kraenhansen

When calling App::current_user from a listener callback registered on a User the thread deadlocks while waiting for the m_user_mutex to release:

std::shared_ptr<SyncUser> SyncManager::get_current_user() const
{
util::CheckedLockGuard lock(m_user_mutex);

But this was already taken by the calling code, here:

std::shared_ptr<SyncUser> SyncManager::get_user(const std::string& user_id, const std::string& refresh_token,
const std::string& access_token, const std::string& device_id)
{
util::CheckedLockGuard lock(m_user_mutex);

This might be related to 64bf842 which was merged 3 months ago and introduced the call to user->log_in:

user->log_in(access_token, refresh_token);

This shows a minimal reproduction in the Realm JS integration tests:

https://github.com/realm/realm-js/blob/f06739da3bcc77dce8e338b1f8960644a33be2c8/integration-tests/tests/src/tests/sync/user-listener-lockup.ts#L31-L43

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0