34 Commits

Author SHA1 Message Date
Ivan FB
1da81c42da
spawn ci aganist release branches 2026-06-04 12:16:53 +02:00
Ivan FB
c77581b694
fix(pool): reuse parked contexts to stop per-cycle fd leak
destroyFFIContext stopped and joined the worker threads on every release,
and createFFIContext rebuilt them on the next acquire. Each cycle therefore
allocated a fresh worker — 4 ThreadSignalPtr socketpairs + the ffi/watchdog
thread chronos dispatcher kqueues — and never reclaimed the old ones (the
pool deliberately skips closing them, relying on slot reuse that never
actually reused the resources). A consumer that creates and destroys
contexts repeatedly (e.g. nim-sds ReliabilityManager) leaked ~10 fds per
cycle, unbounded.

Make the pool genuinely reuse a slot's worker:

- Track per-slot `initialized`; createFFIContext builds the worker once and
  reuses it on every later acquisition of the same slot.
- Add releaseFFIContext: parks a context (returns its slot) WITHOUT stopping
  the threads, so the next acquire reuses the same fds. It also drops the
  stale C event callback so a watchdog tick on a parked slot cannot invoke a
  callback whose user-data the consumer may already have freed. The caller is
  responsible for quiescing its library object (on the FFI thread) first.
- destroyFFIContext keeps full-teardown semantics for error/non-pooling
  paths and now marks the slot uninitialised so a later acquire rebuilds it.

Tests: add a park & reuse suite (same-slot live-worker reuse, callback/lib
pointer dropped on park, and fd usage bounded across 20 park/reuse cycles).
The fd test fails by ~10 fds/cycle against the pre-fix behaviour. Green
under both --mm:refc and --mm:orc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 12:07:17 +02:00
Ivan FB
fb25f069d2
add changelog for 0.1.4 v0.1.4 2026-06-02 23:07:06 +02:00
Ivan FB
1285badcaa
create v0.1.4 2026-06-02 22:53:47 +02:00
Ivan FB
6d31fa30bd
use fixed array of ctx to avoid consuming all fds (#14) 2026-05-13 00:02:23 +02:00
Gabriel Cruz
81c62c263e
fix: context buffer overflow (#21) 2026-05-11 19:21:40 -03:00
Ivan FB
a52c4facd9
Simplified FFI authoring with auto-generated C++ and Rust bindings (#15) 2026-05-11 23:28:17 +02:00
Gabriel Cruz
e99eb60fd1
chore: run tests with refc (#20)
* chore: run tests with refc

* chore: split ci jobs

* chore: fix tests
2026-05-09 10:47:37 -03:00
Gabriel Cruz
37d19c0687
chore: remove CatchableError (#19) 2026-05-08 14:14:16 -03:00
Ivan FB
e3eca63236
first ci version (#12) 2026-04-29 23:48:36 +02:00
Ivan FB
df2277e726
Fix memleaks (#11)
* protect against mem leak in case of failures sending requests to ffi thread
* better cleanup if failures in createFFIContext
* avoid dangling cstring in handleRes under ARC/ORC
* better resource cleanup in destroyFFIContext
* invoke onNotResponding if failure in destroyFFIContext
* correct seq copy in alloc
* make sure the lock is init before cleanUpResources
* better possible exception handling in processReq
* guard allocSharedSeq if given seq is empty
* enhance error handling in ffi_context
* add new tests and some corrections
2026-04-27 21:22:45 +02:00
Pablo Lopez
bb8a3e7e22
fix: add install_name for mac (#8)
not to hardcode the paths
2026-02-20 17:37:13 +02:00
Igor Sirotin
c2c03f1f0f
chore: update license files to comply with Logos licensing requirements 2026-02-05 15:12:18 +00:00
Ivan Folgueira Bande
06111de155
properly importing and exporting chronicles v0.1.3 2026-01-23 17:55:43 +01:00
Ivan Folgueira Bande
d3fe7b4389
properly exposing chronicles and tables when importing ffi v0.1.2 2026-01-23 17:34:01 +01:00
Ivan Folgueira Bande
bb8ed28ab0
add require chronicles taskpools and import std tables v0.1.1 2026-01-23 15:01:08 +01:00
Ivan FB
9fff004b19
add explicit timeout when sending watchdog requests (#7) 2026-01-16 15:48:35 +01:00
Darshan
c2cc2d7ea1
identation error (#5) 2026-01-07 00:01:17 +05:30
Ivan Folgueira Bande
d7a5492121
avoid use gc ed types in FFIContext and better macro documentation 2025-12-13 23:53:59 +01:00
Ivan Folgueira Bande
6811c8675f
make registeredRequests no threadvar
This gives better results in logos-messaging-go-bindings
Can be shared across threads because is populated at compile-time
and only read at run-time.
2025-12-12 14:45:59 +01:00
Ivan Folgueira Bande
803744dd29
rm some Waku leftover references 2025-12-11 23:50:00 +01:00
Ivan FB
75251fb721
Merge pull request #1 from logos-messaging/extend-more
Complete first ffi macro definition
2025-12-11 17:26:01 +01:00
Ivan Folgueira Bande
5964e287a9
rm useless comments 2025-12-11 17:21:47 +01:00
Ivan Folgueira Bande
e0cf0c8842
fixes for proper proc exposure to c 2025-12-11 17:11:59 +01:00
Ivan Folgueira Bande
142a57f543
set logger in main thread body 2025-12-11 17:10:24 +01:00
Ivan Folgueira Bande
da3251aa1a
evolving more 2025-12-10 17:43:26 +01:00
Ivan Folgueira Bande
86dc58e7c2
add ffi macro 2025-12-09 18:51:50 +01:00
Ivan Folgueira Bande
b974eab39c
comment echo repr lines 2025-09-17 14:38:01 +02:00
Ivan Folgueira Bande
3c7f7f9a1c
remove comment 2025-09-17 14:37:53 +02:00
Ivan Folgueira Bande
a1a6536b3c
general ffi increments 2025-09-17 14:37:45 +02:00
Ivan Folgueira Bande
356f0ccc1b
working simplification 2025-09-17 14:37:36 +02:00
Ivan Folgueira Bande
46e51e45a6
more positive progress. Getting closer 2025-09-17 14:37:28 +02:00
Ivan Folgueira Bande
bbddf6925b
First commit 2025-09-17 14:37:11 +02:00
Ivan FB
04fd9f0f6d
Initial commit 2025-09-17 14:34:56 +02:00