Skip to content

Improve error message for failed large hashmap allocation in jbpf #87

Closed

Description

While attempting to create a large hashmap in jbpf, we will see this error:

[2025-04-29T11:51:01.329706Z] [JBPF_ERROR]: The map->data is NULL.
[2025-04-29T11:51:01.329711Z] [JBPF_ERROR]: jbpf map 'delay_hash' could not be created for codelet pdcp_dl_new_sdu

This appears to be due to the map being too large to allocate — it was a hashmap sized at 65536 * 1024 entries.

This failure is due to malloc returning NULL, but the current error message is not very informative. A clearer message such as:

"Couldn't allocate map in memory."

would make the root cause more obvious and save some debugging time.

We already allocate a large amount of memory to jbpf, so it's unclear why this would fail in this case. It could be worth verifying this through a unit test that tries to allocate a large map to reproduce and catch the error more explicitly.

Suggestions:

  • Improve the error message to indicate memory allocation failure.
  • Add a unit test that attempts to allocate a large map to validate this behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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