-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
MemoryPressureNotification got executed on the wrong platform #17859
Comments
The stack trace suggests you haven't actually called |
@bnoordhuis platform->per_isolate_ contains the node main isolate. |
Right, that's not going to work. The Platform is a singleton, there can only be one instance per process. |
@bnoordhuis Thank you for the explanation. |
|
But this one is declared as V8_EXPORT_PRIVATE and it's not in the v8.h for external usage. |
No, but you mentioned that you were already using it. There's no public API at the moment. You shouldn't really need one either because as an embedder you control the platform instance. If you are trying to create a second node instance in another thread - don't, node is not thread-safe. |
Actually I'm not directly using
Btw, what's the point of recently exported |
Can you go in more detail about what you are trying to do? As I mentioned, if you are the embedder, then you already control the platform; and if you are not the embedder, then there should be no need to touch the platform.
It does things V8's basic platform doesn't. (Not that I personally think it's useful to export, or at least for the reasons it was made public for, but that's a separate discussion.) |
Thanks for the explanation. |
You could open a PR that adds that API and see how it's received. Grep src/node.cc for
I'm curious how. IIUC, that's only safe when you suspend the main thread until your thread is done but that kind of heavy-weight serialization defeats the purpose of using threads. |
@bnoordhuis I'm actually doing mostly the same thing, atm if you use them correctly it's totally worth it. while serdes is definitely a pain if you aren't moving obscenely large objects around it's fine. |
Are we talking about the same thing? I mean serialization as in synchronization, the opposite of parallelization, not data marshaling. |
I'll try to follow the guideline and create a pr. |
I tried to register this new isolate in the default platform. MemoryPressureNotification works fine.
The cause is this line when trying to get Environment of this new isolate. I tried two ways in order to fix this:
Could you advise? |
I made it work by shutdown the original platform and then initialize it again with multiIsolatePlatform. |
If it works, it works. The shutdown takes place while there is no active isolate? I think you should be good in that case. |
Thanks |
I'm using the new MultiIsolatePlatform feature added in v9.3.0.
I have following code running in a new node isolate which has its own thread loop. But it have a check failure error when trying to find isolate on the platform.
The thread isolate is registered to the newly create platform when creating isolate data in line 2.
However, line 3 leads to a CHECK failure when trying to find this thread isolate because the platform instance here is returned from V8::GetCurrentPlatform() and it's not the one I created. Here's the callstack:
I'm not sure if I'm using this feature correctly. Could somebody advise?
The text was updated successfully, but these errors were encountered: