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

src: Node implementation of v8::Platform #14001

Closed
wants to merge 8 commits into from
Closed

src: Node implementation of v8::Platform #14001

wants to merge 8 commits into from

Conversation

matthewloring
Copy link

Node.js currently uses the V8 implementation of the DefaultPlatform
which schedules VM tasks on a V8 managed thread pool. Since the Node.js
event loop is not aware of these tasks, the Node.js process may exit
while there are outstanding VM tasks. This will become problematic once
asynchronous wasm compilation lands in V8.

This PR introduces a Node.js specific implementation of the v8::Platform
on top of libuv so that the event loop is aware of outstanding VM tasks.

Fixes: #12980

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

src, tracing

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v4.x inspector Issues and PRs related to the V8 inspector protocol trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. v8 engine Issues and PRs related to the V8 dependency. labels Jun 30, 2017
@matthewloring
Copy link
Author

/cc @jeisinger @nodejs/v8

@matthewloring
Copy link
Author

matthewloring commented Jun 30, 2017

v8/v8@3d8e87a was reverted upstream in V8 due to tsan failures in multi-isolate scenarios. It should be safe for use by Node.js but we can also swap out that commit once it re-lands in V8 before landing this PR.

(edit by @addaleax: turned the git commit ref into a v8/v8@… ref)

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Commented with a few style nits but I think that’s it.

CI: https://ci.nodejs.org/job/node-test-commit/10841/

void NodePlatform::CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) {
uv_work_t* req = new uv_work_t;
req->data = reinterpret_cast<void*>(task);
Copy link
Member

Choose a reason for hiding this comment

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

static_cast?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

double delay_in_seconds) {
double delay_millis = delay_in_seconds * 1000;
uv_timer_t* schedule_req = new uv_timer_t;
schedule_req->data = reinterpret_cast<void*>(task);
Copy link
Member

Choose a reason for hiding this comment

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

static_cast?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

return static_cast<size_t>(threads_);
}

void RunBackgroundTask(uv_work_t *req) {
Copy link
Member

Choose a reason for hiding this comment

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

tiny style nit: uv_work_t* req (like below)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

}

void RunForegroundTask(uv_timer_t* req) {
Task* task = reinterpret_cast<Task*>(req->data);
Copy link
Member

Choose a reason for hiding this comment

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

static_cast here and in the one above as well. ;)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

*/
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled);
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
v8::TracingController* tracing_controller = nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

FYI, conflicts with #13985.

Copy link
Author

Choose a reason for hiding this comment

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

That has landed and this PR has been rebased.

src/node.cc Outdated
tracing::Agent* tracing_agent_;
NodePlatform* platform_;
#else // !NODE_USE_V8_PLATFORM
void Initialize(int thread_pool_size) {}
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be updated to the new prototype.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

src/node.cc Outdated
void PumpMessageLoop(Isolate* isolate) {
v8::platform::PumpMessageLoop(platform_, isolate);
tracing::TraceEventHelper::SetTracingController(
trace_enabled ? tracing_agent_->GetTracingController() : nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

4 space indent.

Copy link
Member

Choose a reason for hiding this comment

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

@bnoordhuis Is there a guideline anywhere for C++ code indentation? I (and others possibly) am usually fairly uncertain where the 4-space rule should apply, and where 2-space.

Copy link
Member

Choose a reason for hiding this comment

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

I’m not sure we’ve written it done somewhere, but generally, use 4 spaces if it’s a statement continuation, 2 spaces if it’s indentation for a block/loop body/conditional statement body/etc.

Copy link
Author

Choose a reason for hiding this comment

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

I've updated to 4 spaces.

src/node.cc Outdated
void Initialize(int thread_pool_size, uv_loop_t* loop) {
tracing_agent_ =
trace_enabled ? new tracing::Agent() : nullptr;
platform_ = new NodePlatform(thread_pool_size, loop,
Copy link
Member

Choose a reason for hiding this comment

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

These are never freed?

Copy link
Author

Choose a reason for hiding this comment

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

They are now freed in Dispose.

delete req;
}

void RunForegroundTask(uv_timer_t* req) {
Copy link
Member

Choose a reason for hiding this comment

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

s/req/handle/?

Copy link
Author

Choose a reason for hiding this comment

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

Done throughout.


double NodePlatform::MonotonicallyIncreasingTime() {
// Convert nanos to seconds
return uv_hrtime() / 1000000000.0;
Copy link
Member

Choose a reason for hiding this comment

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

1e9 is a little easier to parse for humans. Can you punctuate the comment?

Copy link
Author

Choose a reason for hiding this comment

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

Done.


using v8::Isolate;
using v8::Platform;
using v8::Task;
Copy link
Member

Choose a reason for hiding this comment

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

Can you move these to the .cc file and use fully qualified names here? Rule of thumb: no using declarations in headers.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

v8::TracingController* GetTracingController() override;

private:
int threads_;
Copy link
Member

Choose a reason for hiding this comment

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

Can you call this e.g. num_threads_?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

return static_cast<size_t>(threads_);
}

void RunBackgroundTask(uv_work_t *req) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe these internal functions could be made static or part of an anonymous namespace?

Copy link
Member

Choose a reason for hiding this comment

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

Good point – they might be best written as lambdas, for readability?

Copy link
Author

Choose a reason for hiding this comment

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

I found that with lambdas there were too many variables named handle. I've made them static for now. I can switch to lambdas if that is preferred.

#include "node_mutex.h"
#include "uv.h"

#include <queue>
Copy link
Member

Choose a reason for hiding this comment

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

Are node_mutex.h and queue actually used anywhere within the file?

Copy link
Author

Choose a reason for hiding this comment

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

Removed.

@matthewloring
Copy link
Author

Thanks for the comments! I'm currently looking into some intermittent crashes in GC brought on by this change. I'll address these comments once I figure that out.

size_t NumberOfAvailableBackgroundThreads() override;
void CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) override;
void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override;
Copy link
Member

Choose a reason for hiding this comment

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

Should this just be Isolate* or should the others be v8::Isolate*

Copy link
Author

Choose a reason for hiding this comment

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

These should all be v8::Isolate.

class NodePlatform : public Platform {
public:
NodePlatform(int thread_pool_size, uv_loop_t* loop,
v8::TracingController* tracing_controller);
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice if the API for NodePlatform did not depend on v8 specific types like v8::TracingController and v8::Isolate (below) but it is still a good start just be abstracting NodePlatform itself.

Copy link
Author

Choose a reason for hiding this comment

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

This was discussed briefly in #12980. This is not an attempt to define a general VM interface. The only goal is to provide a new implementation of v8::Platform as the default platform which is currently used by Node will may allow the process to exit during wasm module compilation.

Task* task = static_cast<Task*>(handle->data);
task->Run();
delete task;
delete handle;
Copy link
Contributor

Choose a reason for hiding this comment

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

ASAN complains about this line, it looks like uv_run() tries to delete this handle as well.

Copy link
Member

Choose a reason for hiding this comment

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

This needs to call uv_close() and not free the memory until the close callback is called.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, does the same logic apply to the uv_work_t in AfterBackgroundTask?

src/node.cc Outdated
tracing_agent_ =
trace_enabled ? new tracing::Agent() : nullptr;
platform_ = new NodePlatform(thread_pool_size, loop,
trace_enabled ? tracing_agent_->GetTracingController() : nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: four space indent.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

src/node.cc Outdated
}

void Dispose() {
delete platform_;
platform_ = nullptr;
delete tracing_agent_;
Copy link
Member

Choose a reason for hiding this comment

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

Can you set tracing_agent_ = nullptr;?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

Task* task = static_cast<Task*>(handle->data);
task->Run();
delete task;
delete handle;
Copy link
Member

Choose a reason for hiding this comment

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

This needs to call uv_close() and not free the memory until the close callback is called.


void NodePlatform::CallOnBackgroundThread(Task* task,
ExpectedRuntime expected_runtime) {
uv_work_t* handle = new uv_work_t;
Copy link
Member

Choose a reason for hiding this comment

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

Can you call new uv_work_t() here? Coverity tends to complain about heap-allocating structures without initializing them. Same a few lines below with the new uv_timer_t call.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

uv_timer_t* handle = new uv_timer_t;
handle->data = static_cast<void*>(task);
uv_timer_init(loop_, handle);
// Timers may not guarentee queue ordering of events with the same delay if
Copy link
Member

Choose a reason for hiding this comment

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

Typo: guarantee

Copy link
Author

Choose a reason for hiding this comment

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

Done.


private:
int num_threads_;
uv_loop_t* loop_;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make these const since they'll never change.

Copy link
Author

Choose a reason for hiding this comment

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

I've made the thread count const. uv_timer_init and uv_queue_work don't like const loops.

Copy link
Member

Choose a reason for hiding this comment

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

I mean uv_loop_t* const loop, i.e., non-reseatable pointer. Not a big thing though.

@@ -3,14 +3,14 @@
namespace node {
namespace tracing {

v8::Platform* platform_ = nullptr;
v8::TracingController* controller_ = nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

Since you're here: g_controller? We use underscore suffix convention really only for data members.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@matthewloring
Copy link
Author

bnoordhuis
bnoordhuis previously approved these changes Jul 21, 2017
@matthewloring
Copy link
Author

The CI looks mostly green. The repl timeout seems unrelated. The test-timers-unrefed-in-beforeexit failure is real. If V8 queues up background work during the execution of the beforeExit function, the event loop stays open waiting for that work to complete and then reruns the beforeExit callback again. This can cause the process to hang for sufficiently complicated beforeExit callbacks (I can reproduce this by allocating lots of buffers in beforeExit).

One option would be to drop all V8 background tasks queued during the execution of beforeExit. However, this could be problematic if the user expects to recover and continue execution. @jeisinger Is it possible for background tasks to be dropped or will this leave V8 in an inconsistent state?

@jeisinger
Copy link
Contributor

some background tasks from the GC will count down semaphores while the main thread waits for the semaphore, so not running background tasks will result in a deadlock on the main thread.

@matthewloring
Copy link
Author

If background tasks are allowed to be queue during the beforeExit callback, the process could repeatedly invoke beforeExit forever. If background tasks are buffered during the execution of beforeExit and flushed afterwards, the process could deadlock. I experimented with starting another thread at the beginning of beforeExit that could flush background tasks on a timer to make progress if a deadlock occurs. However this is sub-optimal as the process would still hang until the timer fires or beforeExit could still be executing when the timer fires. @jeisinger Would it be possible for the platform API to expose a task priority or some other indicator of whether a task should hold the process open? Longer term would it be possible to move away from blocking the main thread on background task completion?

@matthewloring
Copy link
Author

Flushing all background tasks after beforeExit executes has appeased tests locally. New CI: https://ci.nodejs.org/job/node-test-pull-request/9442/.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Just reaffirming that this still LGTM

@matthewloring
Copy link
Author

For an update on this, I worked with the V8 team to stop the main thread from blocking on background task completion (reflected in the most recent 3 backports on the PR). A more desirable fix would be to let background tasks started inside beforeExit run and then block until all have completed before determining whether the event loop still has active handles/requests and the process should stay up. However, since background tasks are run using uv_queue_work, there will be active requests in the event loop even after blocking until all background tasks have completed the background portion of their work. The event loop must be run at least once to clear these requests (so that they won't be observed when uv_loop_alive is checked) but there seem to be a fair number of unit tests that depended on no io polling before the uv_loop_alive check. If there was a way to cancel these background tasks after their background work was completed to avoid having their after callbacks added to the event loop or a way to unref reqs as can be done with handles that would solve the problem. @bnoordhuis do you have any thoughts on a work around for this problem?

The current solution will only be problematic if V8 background tasks started inside beforeExit queue foreground tasks as those new foreground tasks will not keep the process up (as will be the case for WASM asynchronous compilation). However, no current V8 background tasks have that behavior to my knowledge so this should be safe for now.

I've started a fresh CI here: https://ci.nodejs.org/job/node-test-pull-request/9486/

@matthewloring
Copy link
Author

It looks like there is one remaining related failure which is on windows: https://ci.nodejs.org/job/node-test-binary-windows/10290/RUN_SUBSET=1,VS_VERSION=vs2017,label=win2016/tapResults/. I can try to get my hands on a windows machine but if anyone on @nodejs/platform-windows can reproduce this or has thoughts on why libuv is unhappy I'd appreciate the help.

@matthewloring
Copy link
Author

matthewloring commented Aug 6, 2017

After a few more fixes, it looks like inspector/test-off-with-session-then-on is failing on windows intermittently. @eugeneo Do you have any thoughts on these failures? (example CI: https://ci.nodejs.org/job/node-test-commit/11587/).

Copy link
Member

@tniessen tniessen left a comment

Choose a reason for hiding this comment

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

src/* LGTM

targos pushed a commit to targos/node that referenced this pull request Sep 14, 2017
Original commit message:

  [heap] Move SweeperTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6655
  Change-Id: Icdaae744ee73146b86b9a28c8035138746721971
  Reviewed-on: https://chromium-review.googlesource.com/595467
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47036}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos pushed a commit to targos/node that referenced this pull request Sep 14, 2017
Original commit message:

  Make CancelableTask ids unique
  They were only limited to 32 bit when using the internal Hashmap. Since
  this has changed alreay some time ago, we can switch to 64 bit ids and
  check that we never overflow.

  Bug:
  Change-Id: Ia6c6d02d6b5e555c6941185a79427dc4aa2a1d62
  Reviewed-on: https://chromium-review.googlesource.com/598229
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47085}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos pushed a commit to targos/node that referenced this pull request Sep 14, 2017
Original commit message:

  [heap] Move UnmapFreeMemoryTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6671
  Change-Id: I741d4b7594e8d62721dad32cbfb19551ffacd0c3
  Reviewed-on: https://chromium-review.googlesource.com/599528
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47126}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
if (uv_run(env.event_loop(), UV_RUN_NOWAIT) != 0)
more = true;
}
uv_run(env.event_loop(), UV_RUN_DEFAULT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is everyone here sure this doesn't break something edge-casey with beforeExit and order of operations?

I'm trying to dig into it but have pretty much run out of time this week.

It seems to me that in some case(s) before, uv callbacks may have been called twice before the next beforeExit, which could alter things at the very least like an addon that uses a uv_check_t handle?

@MylesBorins
Copy link
Contributor

I'm assuming that this is not applicable to the 6.x branch. Please let me know if I am mistaken

/cc @nodejs/v8 @nodejs/tsc

targos pushed a commit to targos/node that referenced this pull request Sep 21, 2017
Original commit message:

  [heap] Move SweeperTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6655
  Change-Id: Icdaae744ee73146b86b9a28c8035138746721971
  Reviewed-on: https://chromium-review.googlesource.com/595467
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47036}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos pushed a commit to targos/node that referenced this pull request Sep 21, 2017
Original commit message:

  Make CancelableTask ids unique
  They were only limited to 32 bit when using the internal Hashmap. Since
  this has changed alreay some time ago, we can switch to 64 bit ids and
  check that we never overflow.

  Bug:
  Change-Id: Ia6c6d02d6b5e555c6941185a79427dc4aa2a1d62
  Reviewed-on: https://chromium-review.googlesource.com/598229
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47085}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
targos pushed a commit to targos/node that referenced this pull request Sep 21, 2017
Original commit message:

  [heap] Move UnmapFreeMemoryTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6671
  Change-Id: I741d4b7594e8d62721dad32cbfb19551ffacd0c3
  Reviewed-on: https://chromium-review.googlesource.com/599528
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{nodejs#47126}

PR-URL: nodejs#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
hferreiro pushed a commit to brave/node that referenced this pull request Sep 27, 2017
V8 modified the platform API to accept a tracing controller at platform
creation time that is required to be present for the lifetime of the
platform if tracing will every be enabled. This will simplify the
implementation of a v8::Platform subclass for node.

PR-URL: nodejs/node#14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 28, 2017
Original commit message:

  [heap] Move SweeperTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6655
  Change-Id: Icdaae744ee73146b86b9a28c8035138746721971
  Reviewed-on: https://chromium-review.googlesource.com/595467
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47036}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 28, 2017
Original commit message:

  Make CancelableTask ids unique
  They were only limited to 32 bit when using the internal Hashmap. Since
  this has changed alreay some time ago, we can switch to 64 bit ids and
  check that we never overflow.

  Bug:
  Change-Id: Ia6c6d02d6b5e555c6941185a79427dc4aa2a1d62
  Reviewed-on: https://chromium-review.googlesource.com/598229
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47085}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 28, 2017
Original commit message:

  [heap] Move UnmapFreeMemoryTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6671
  Change-Id: I741d4b7594e8d62721dad32cbfb19551ffacd0c3
  Reviewed-on: https://chromium-review.googlesource.com/599528
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47126}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 29, 2017
Original commit message:

  [heap] Move SweeperTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6655
  Change-Id: Icdaae744ee73146b86b9a28c8035138746721971
  Reviewed-on: https://chromium-review.googlesource.com/595467
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47036}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 29, 2017
Original commit message:

  Make CancelableTask ids unique
  They were only limited to 32 bit when using the internal Hashmap. Since
  this has changed alreay some time ago, we can switch to 64 bit ids and
  check that we never overflow.

  Bug:
  Change-Id: Ia6c6d02d6b5e555c6941185a79427dc4aa2a1d62
  Reviewed-on: https://chromium-review.googlesource.com/598229
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47085}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Sep 29, 2017
Original commit message:

  [heap] Move UnmapFreeMemoryTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6671
  Change-Id: I741d4b7594e8d62721dad32cbfb19551ffacd0c3
  Reviewed-on: https://chromium-review.googlesource.com/599528
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47126}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@MylesBorins MylesBorins mentioned this pull request Oct 3, 2017
MylesBorins pushed a commit that referenced this pull request Oct 3, 2017
Original commit message:

  [heap] Move SweeperTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6655
  Change-Id: Icdaae744ee73146b86b9a28c8035138746721971
  Reviewed-on: https://chromium-review.googlesource.com/595467
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47036}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Oct 3, 2017
Original commit message:

  Make CancelableTask ids unique
  They were only limited to 32 bit when using the internal Hashmap. Since
  this has changed alreay some time ago, we can switch to 64 bit ids and
  check that we never overflow.

  Bug:
  Change-Id: Ia6c6d02d6b5e555c6941185a79427dc4aa2a1d62
  Reviewed-on: https://chromium-review.googlesource.com/598229
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47085}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
MylesBorins pushed a commit that referenced this pull request Oct 3, 2017
Original commit message:

  [heap] Move UnmapFreeMemoryTask to CancelableTask
  This mitigates the problem of blocking on the main thread when the
  platform is unable to execute background tasks in a timely manner.

  Bug: v8:6671
  Change-Id: I741d4b7594e8d62721dad32cbfb19551ffacd0c3
  Reviewed-on: https://chromium-review.googlesource.com/599528
  Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
  Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
  Cr-Commit-Position: refs/heads/master@{#47126}

Backport-PR-URL: #15393
PR-URL: #14001
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@davisjam davisjam mentioned this pull request Sep 3, 2018
4 tasks
@addaleax addaleax added the v8 platform Issues and PRs related to Node's v8::Platform implementation. label Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. v8 engine Issues and PRs related to the V8 dependency. v8 platform Issues and PRs related to Node's v8::Platform implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider implementing v8::Platform on top of libuv instead of using the default platform