diff --git a/CHANGELOG.md b/CHANGELOG.md index e5550750d72..d7aa249ce09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Enhancements * (PR [#????](https://github.com/realm/realm-core/pull/????)) * Added support for server log messages that are enabled by sync protocol version 10. Appservices request id will be provided in a server log message in a future server release. ([PR #6476](https://github.com/realm/realm-core/pull/6476)) +* Throw an exception if `File::unlock` has failed, in order to inform the SDK that we are likely hitting some limitation on the OS filesystem, instead of crashing the application.([PR #6926](https://github.com/realm/realm-core/pull/6926)) ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) diff --git a/src/realm/util/file.cpp b/src/realm/util/file.cpp index 09c0f99f35b..611d65368f5 100644 --- a/src/realm/util/file.cpp +++ b/src/realm/util/file.cpp @@ -1098,7 +1098,10 @@ static void _unlock(int m_fd) do { r = flock(m_fd, LOCK_UN); } while (r != 0 && errno == EINTR); - REALM_ASSERT_RELEASE_EX(r == 0 && "File::unlock()", r, errno); + if (r && errno) { + throw RuntimeError(ErrorCodes::RuntimeError, + "File::unlock() has failed, this is likely due to some limitation in the OS file system."); + } } #endif