flipt-io / flipt-client-sdks

Flipt Client-Side Evaluation SDKs
https://www.flipt.io/docs/integration/client
MIT License
5 stars 6 forks source link

[FLI-861] Try to handle panics in engine #148

Open markphelps opened 4 months ago

markphelps commented 4 months ago
thread '<unnamed>' panicked at flipt-engine-ffi/src/lib.rs:212:79:

Thank you @markphelps, that helps to understand the issue better. That unwrap could panic in many cases if there is an connection or configuration issue. It would be great if initialize_engine could return an error to upstream instead of panic. Don't know if that is possible with FFI.

Yeah agreed. We should see if we can recover from panic in FFI/Flipt Evaluation layer and always return an error instead of crashing the client. Will create an issue for this in the flipt-client-sdk repo

Originally posted by @markphelps in https://github.com/flipt-io/flipt/issues/2791#issuecomment-1956875106

FLI-861

markphelps commented 3 months ago

This from the stdlib may be helpful per the Rust FFI docs: https://doc.rust-lang.org/nomicon/ffi.html#catching-panic-preemptively