-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set error if mmap address space is exhausted #3437
Conversation
@@ -8,7 +8,7 @@ x.x.x Release notes (yyyy-MM-dd) | |||
|
|||
### Enhancements | |||
|
|||
* None. | |||
* Fail with `RLMErrorAddressSpaceExhausted` if unable to acquire more mmap memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a recoverable RLMErrorAddressSpaceExhausted
error rather than crashing when failing to mmap in Realm initialization or write commit.
d8c12bd
to
6d49615
Compare
Some context from a previous conversation: although this exception can be thrown in One solution to this might be to allow users to register custom error handlers that we would invoke for them, but the recovery options would still be very limited, so probably not worthwhile implementing unless there's a strong demand for it. I'll wait for the compile issues to be sorted out before doing a full review. |
6d49615
to
a748e88
Compare
This passes now on CI. (Jenkins failure is due to the device build being aborted.) |
It'd be nice to have a test that verifies that we actually get the correct error and that it's recoverable. An idea for how to do this is:
This would obviously need to be 32-bit only. It may turn out to be unreasonably slow to run it as part of the normal test suite, but it'd still be good to at least do a one-time verification. |
👍 if testing confirms this works |
I think, I could reproduce it, assuming that my test case makes sense. 🙈 |
I think it would be good if someone could review my test case and give a 👍 if everything is alright. |
vm_address_t address; | ||
vm_size_t size; | ||
}; | ||
typedef struct VirtualMemoryChunk VirtualMemoryChunk; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This typedef
shouldn't be necessary since this code is in an Objective-C++ file.
👍 |
1 similar comment
👍 |
7f4b10e
to
a05de65
Compare
45823b7
to
40563fd
Compare
40563fd
to
124856d
Compare
* master: [Test] Try to exhaust adress space on device/32-bit sim only [Test] Check that AddressSpaceExhausted is correctly rethrown [CHANGELOG] Add entry for #3437 Catch AddressSpaceExhausted and set error [Doc] Fix inconsistency for Error. IncompatibleLockFile
This is based on the assumption that the address space will be exhausted most commonly either on trying to map a Realm database which doesn't fit in the left address space or on committing a writing transaction when the memory is resized, while this could also happen on (auto-)refreshes.
Fixes #2269.
/c @jpsim @bdash @tgoyne