Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macos: core: macOS coroutine unstability fixes #7820

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion include/fluent-bit/flb_coro.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,20 @@ struct flb_coro {
void *data;
};

#ifdef FLB_SYSTEM_MACOS
#ifdef __aarch64__
#define STACK_FACTOR 1.5 /* Use 36KiB for coro stacks */
#else
#define STACK_FACTOR 2 /* Use 24KiB for coro stacks */
#endif
#else
#define STACK_FACTOR 1
#endif

#ifdef FLB_CORO_STACK_SIZE
#define FLB_CORO_STACK_SIZE_BYTE FLB_CORO_STACK_SIZE
#else
#define FLB_CORO_STACK_SIZE_BYTE ((3 * PTHREAD_STACK_MIN) / 2)
#define FLB_CORO_STACK_SIZE_BYTE ((3 * STACK_FACTOR * PTHREAD_STACK_MIN) / 2)
#endif

#define FLB_CORO_DATA(coro) (((char *) coro) + sizeof(struct flb_coro))
Expand Down
4 changes: 3 additions & 1 deletion plugins/in_event_test/event_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ static int cb_collector_time(struct flb_input_instance *ins,

now = time(NULL);
diff = now - config->init_time;
if (diff > CALLBACK_TIME) {
/* For macOS, we sometimes get the +1 longer time elapse.
* To handle this, we simply add +1 as a delta for checking interval. */
if (diff > (CALLBACK_TIME + 1)) {
flb_plg_error(ins, "cb_collector_time difference failed: %i seconds", diff);
set_unit_test_status(ctx, 0, STATUS_ERROR);
flb_engine_exit(config);
Expand Down