As discussed on Tigerbeetle's Slack, the packet data must stay valid until the request is completed, but the current code is currently depending on the payload term staying valid until the end of the request since the resource is released as soon as it's created.
A call to enif_keep_resource or equivalent should be added in the submit function, matched with a enif_release_resource in the on_completion callback.
As discussed on Tigerbeetle's Slack, the packet data must stay valid until the request is completed, but the current code is currently depending on the payload term staying valid until the end of the request since the resource is released as soon as it's created. A call to
enif_keep_resource
or equivalent should be added in thesubmit
function, matched with aenif_release_resource
in theon_completion
callback.