Skip to content

Commit

Permalink
Fix appsignal_free_* FFI missing pointer arguments (#856)
Browse files Browse the repository at this point in the history
The `appsignal_free_transaction` and `appsignal_free_data` Rust
extension function calls were missing their argument definitions in the
FFI declaration.

These are the function definitions from the `appsignal.h` file,
downloaded upon installation.

```c
void appsignal_free_transaction(appsignal_transaction_t*);
void appsignal_free_data(appsignal_data_t*);
```

Fixes #854 where users saw very high CPU usage because the function call
was being retried indefinitely.

Co-authored-by: Raimonds Simanovskis <[email protected]>
  • Loading branch information
tombruijn and rsim authored Jul 22, 2022
1 parent f261cf5 commit e555a81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changesets/fix-ffi-arguments-for-free-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix FFI function calls missing arguments for `appsignal_free_transaction` and `appsignal_free_data` extension functions. This fixes a high CPU issue when these function calls would be retried indefinitely.
4 changes: 2 additions & 2 deletions lib/appsignal/extension/jruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def self.lib_extension

# Transaction methods
attach_function :appsignal_free_transaction,
[],
[:pointer],
:void
attach_function :appsignal_start_transaction,
[:appsignal_string, :appsignal_string, :long],
Expand Down Expand Up @@ -191,7 +191,7 @@ def self.lib_extension
:void

# Data struct methods
attach_function :appsignal_free_data, [], :void
attach_function :appsignal_free_data, [:pointer], :void
attach_function :appsignal_data_map_new, [], :pointer
attach_function :appsignal_data_array_new, [], :pointer
attach_function :appsignal_data_map_set_string,
Expand Down

0 comments on commit e555a81

Please sign in to comment.