OOM handling in C
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the JNI binding entry point mentioned at src/main/c/h3-java/src/jniapi.c#L44, then trace the H3 C functions it calls and their malloc/calloc/realloc handling. Done means out-of-memory failures are propagated through the relevant C and Java binding layers instead of causing assertions or NULL-pointer undefined behavior.
Written by the indexing model from the issue text.
Description
The h3 C library does not handle the case of malloc/calloc/realloc returning NULL in a robust manner. If assertions are enabled, the library crashes, otherwise it will use the NULL pointer leading to undefined behavior. While I understand the convenience of this design in the C library, not propagating OOM errors up the stack means binding code like this is not reliable: https://github.com/uber/h3-java/blob/ed818d3d07c005576c0f96490015f388992b6df8/src/main/c/h3-java/src/jniapi.c#L44 Users are likely to see a sudden fatal crash in the Java process and may not see any hint to the C assertion. Practically, consider using return codes to handle OOM up the stack for your C functions so you can handle them probably here.
- Dominant language
- Java
- Stars
- 333
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uber/h3-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·