Skip to content
Snippets Groups Projects
Commit 24c4506c authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

box: don't raise OutOfMemory error from opts_decode

For some options (OPT_STRPTR, OPT_CUSTOM), opts_decode may need to
allocate the result from the fiber region. The allocation shouldn't
normally fail (if it fails, it means the system is misconfigured and it
doesn't make much sense to carry on; essentially, the fiber region is
used like a stack). Still, we try to handle memory allocation failures
gracefully there by returning OutOfMemory error. This complicates the
opts_decode function protocol: we can't use IllegalParams for
propagating errors and convert the error to ClientError with a proper
error code at the call site, because the error would look ridiculous on
OOM (for example, "Wrong space options: Failed to allocate XX bytes for
..."). Instead, we have to pass the error code for ClientError to
opts_decode, which, in turn, makes it impossible to set the proper space
field or index part number for the sake of verbosity.

To address this issue, let's use xregion_alloc instead of region_alloc
and remove all OutOfMemory errors from opts_decode itself as well as all
callbacks that may allocate memory from the region.

Needed for #7933

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
parent 339ae58f
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment