Skip to content

Commit

Permalink
Merge pull request #483 from MrAnno/fix-birth-timeout-deadlock
Browse files Browse the repository at this point in the history
core: fix deadlock in overloaded scenarios
  • Loading branch information
MrAnno committed Mar 27, 2023
2 parents 4fd5418 + d70cc5d commit e87f6ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ bool handle_birth(struct server_ctx *sctx, struct client_ctx *ctx, const criteri
(void) sctx;
(void) msg;

ctx->alive = true;
ctx->dead = false;
return false;
}

Expand Down Expand Up @@ -452,7 +452,7 @@ bool handle_death(struct server_ctx *sctx, struct client_ctx *ctx, const criteri
{
(void) sctx;

ctx->alive = false;
ctx->dead = true;

const criterion_protocol_death *death = &msg->data.value.death;
enum client_state curstate = ctx->state & (CS_MAX_CLIENT_STATES - 1);
Expand Down
2 changes: 1 addition & 1 deletion src/core/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct client_ctx {
struct criterion_test extern_test;

uint32_t state;
bool alive;
bool dead;
struct criterion_global_stats *gstats;
struct criterion_suite_stats *sstats;
struct criterion_test_stats *tstats;
Expand Down
2 changes: 1 addition & 1 deletion src/core/runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static void run_tests_async(struct criterion_test_set *set,
if (!cctx)
continue;

if (!cctx->alive) {
if (cctx->dead) {
if ((cctx->tstats->test_status == CR_STATUS_FAILED) && criterion_options.fail_fast)
cr_terminate(cctx->gstats);

Expand Down

0 comments on commit e87f6ae

Please sign in to comment.