Skip to content

Improve detection of task process exit#10776

Merged
Gudahtt merged 1 commit intodevelopfrom
improve-task-process-exit-detection
Mar 31, 2021
Merged

Improve detection of task process exit#10776
Gudahtt merged 1 commit intodevelopfrom
improve-task-process-exit-detection

Conversation

@Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Mar 30, 2021

Our build script waits for the close event to determine whether the task has exited. The exit event is a better representation of this, because if a stream is shared between multiple processes, the process may exit without the close event being emitted.

We aren't sharing streams between processes, so this edge case doesn't apply to us. This just seemed like a more suitable event to listen to, since we care about the process exiting not the stream ending.

See this description of the close event from the Node.js documentation:

The 'close' event is emitted when the stdio streams of a child process have been closed. This is distinct from the 'exit' event, since multiple processes might share the same stdio streams.

And see this description of the exit event:

The 'exit' event is emitted after the child process ends.

Our build script waits for the `close` event to determine whether the
task has exited. The `exit` event is a better representation of this,
because if a stream is shared between multiple processes, the process
may exit without the `close` event being emitted.

We aren't sharing streams between processes, so this edge case doesn't
apply to us. This just seemed like a more suitable event to listen to,
since we care about the process exiting not the stream ending.

See this description of the `close` event from the Node.js
documentation [1]:

>The `'close'` event is emitted when the stdio streams of a child
>process have been closed. This is distinct from the `'exit'` event,
>since multiple processes might share the same stdio streams.

And see this description of the `exit` event:

>The `'exit'` event is emitted after the child process ends.

[1]: https://nodejs.org/docs/latest-v14.x/api/child_process.html#child_process_event_exit
@Gudahtt Gudahtt requested review from a team and kumavis as code owners March 30, 2021 22:32
@Gudahtt Gudahtt requested a review from shanejonas March 30, 2021 22:32
@metamaskbot
Copy link
Collaborator

Builds ready [a7ecd4f]
Page Load Metrics (559 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint44765794
domContentLoaded3726295588641
load3736305598641
domInteractive3726295578641

Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Gudahtt Gudahtt merged commit b124ac2 into develop Mar 31, 2021
@Gudahtt Gudahtt deleted the improve-task-process-exit-detection branch March 31, 2021 15:43
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants