Continued #39 - TLDR: Solution is not scalable. Should only affect dart test --concurrency 16.
Simple Approach: The ErrorTranslator singleton C class stores an error_message that is set in C and read from Dart.
However, when running dart test, the default concurrency is 16. Meaning that at once, we can have up-to 16 instances of Dart Seal objects.
As a result, we may receive intermittent failures when concurrency > 1. This should not affect users as all C FFI calls are synchronous. If there are multiple instances, they would be invoked sequentially.
Potential Solutions:
For each C function, pass Pointer as parameter.
This race condition can be solved by creating / managing ErrorTranslator instances for ffi invocation. However this may be overkill.
For each C function, pass string (char*) as parameter:
Simple, and a bit more transparent. Would require some additional logic to capture errors + return string. May introduce ambiguous complexity
Continued #39 - TLDR: Solution is not scalable. Should only affect
dart test --concurrency 16
.Simple Approach: The
ErrorTranslator
singleton C class stores anerror_message
that is set in C and read from Dart.However, when running
dart test
, the default concurrency is 16. Meaning that at once, we can have up-to 16 instances of DartSeal
objects.As a result, we may receive intermittent failures when concurrency > 1. This should not affect users as all C FFI calls are synchronous. If there are multiple instances, they would be invoked sequentially.
Potential Solutions:
For each C function, pass Pointer as parameter. This race condition can be solved by creating / managing ErrorTranslator instances for ffi invocation. However this may be overkill.
For each C function, pass string (char*) as parameter: Simple, and a bit more transparent. Would require some additional logic to capture errors + return string. May introduce ambiguous complexity