Skip to content

Commit

Permalink
Merge pull request #3884 from terascope/shutdown-error-logging-improv…
Browse files Browse the repository at this point in the history
…ements

[teraslice] add logs to debug shutdown failures in execution controller
  • Loading branch information
sotojn authored Dec 18, 2024
2 parents cda74ec + 30a4bfc commit a2daaa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 9 additions & 3 deletions packages/teraslice/src/lib/workers/execution-controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ export class ExecutionController {

// start creating / dispatching slices, this will block until done
await Promise.all([
this.client.sendAvailable(),
this._runDispatch(),
this.scheduler.run()
this.client.sendAvailable().then(() => this.logger.debug('client.sendAvailable() promise resolved')),
this._runDispatch().then(() => this.logger.debug('_runDispatch() promise resolved')),
this.scheduler.run().then(() => this.logger.debug('scheduler.run() promise resolved'))
]);

const schedulerSuccessful = this.scheduler.isFinished && this.scheduler.slicersDone;
Expand Down Expand Up @@ -665,6 +665,7 @@ export class ExecutionController {
clearInterval(dispatchInterval);

this.isDoneDispatching = true;
this.logger.debug('done dispatching slices');
}

_dispatchSlice(slice: Slice, workerId: string) {
Expand Down Expand Up @@ -916,6 +917,11 @@ export class ExecutionController {
this.exId
} to finish...`
);
this.logger.debug(`Execution controller state vars at timeout:\nisExecutionDone: ${this.isExecutionDone}\nclient.ready: ${this.client.ready}\n`
+ `onlineClientCount: ${this.server.onlineClientCount}\nserver.isShuttingDown: ${this.server.isShuttingDown}`
+ `isShuttingDown: ${this.isShuttingDown}\nisShutdown: ${this.isShutdown}\n`
+ `isDoneDispatching: ${this.isDoneDispatching}\npendingDispatches: ${this.pendingDispatches}\n`
+ `scheduler.isFinished: ${this.scheduler.isFinished}\npendingSlices: ${this.pendingSlices}\n`);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ export class Scheduler {
);

await pWhile(async () => {
if (!this._creating) return true;
if (!this._creating) {
this.logger.debug('done creating remaining slices');
return true;
}
this.logger.debug(`waiting for ${this._creating} remaining slices to be created...`);
await pDelay(100);
return false;
});
Expand Down

0 comments on commit a2daaa4

Please sign in to comment.