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: remove misplaced windows code under posix guard in node.cc #52545

Closed

Conversation

thisalihassan
Copy link
Contributor

The V8 WebAssembly trap handler setup for Windows was incorrectly nested within a POSIX conditional compilation block in src/node.cc. This caused the related functions to be effectively non-operational on Windows. The changes involve removing the Windows-specific code from the POSIX section and correctly placing it under the WIN32 check.

Fixes: #52404
Refs: #35033

The V8 WebAssembly trap handler setup for Windows was incorrectly
nested within a POSIX conditional compilation block in src/node.cc.
This caused the related functions to be effectively non-operational
on Windows. The changes involve removing the Windows-specific code from
the POSIX section and correctly placing it under the WIN32 check.
This fix will ensure that the intended exception handling is active
on Windows builds.

Fixes: nodejs#52404
Refs: nodejs#35033
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Apr 15, 2024
@thisalihassan thisalihassan marked this pull request as draft April 15, 2024 19:08
@thisalihassan thisalihassan marked this pull request as ready for review April 16, 2024 06:33
src/node.cc Show resolved Hide resolved
src/node.cc Outdated
Comment on lines 645 to 648
// Tell V8 to disable emitting WebAssembly
// memory bounds checks. This means that we have
// to catch the SIGSEGV/SIGBUS in TrapWebAssemblyOrContinue
// and pass the signal context to V8.
Copy link
Member

Choose a reason for hiding this comment

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

I think this comment is valid still. Why don't we leave it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure I will revert this change

src/node.cc Show resolved Hide resolved
@daeyeon daeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 19, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 19, 2024
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Apr 21, 2024

Looks like it doesn't work on x86:

00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,9): error C2664: 'PVOID AddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER)': cannot convert argument 2 from 'LONG (__cdecl *)(EXCEPTION_POINTERS *)' to 'PVECTORED_EXCEPTION_HANDLER' [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,44): message : None of the functions with this name in scope match the target type [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\errhandlingapi.h(134,1): message : see declaration of 'AddVectoredExceptionHandler' [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,9): message : while trying to match the argument list '(const ULONG, overloaded-function)' [C:\workspace\node-compile-windows\node\libnode.vcxproj]

@thisalihassan
Copy link
Contributor Author

thisalihassan commented Apr 21, 2024

Looks like it doesn't work on x86:

00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,9): error C2664: 'PVOID AddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER)': cannot convert argument 2 from 'LONG (__cdecl *)(EXCEPTION_POINTERS *)' to 'PVECTORED_EXCEPTION_HANDLER' [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,44): message : None of the functions with this name in scope match the target type [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\errhandlingapi.h(134,1): message : see declaration of 'AddVectoredExceptionHandler' [C:\workspace\node-compile-windows\node\libnode.vcxproj]
00:18:01 C:\workspace\node-compile-windows\node\src\node.cc(685,9): message : while trying to match the argument list '(const ULONG, overloaded-function)' [C:\workspace\node-compile-windows\node\libnode.vcxproj]

I have AMD64 windows and build is successful with ./vcbuild. Is it failing on 32 Bit?

Fixed

@daeyeon daeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 22, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 22, 2024
@nodejs-github-bot
Copy link
Collaborator

@thisalihassan
Copy link
Contributor Author

win-vs2022-arm64
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xtr1common(56,21): fatal error C1060: compiler is out of heap space [C:\workspace\node-compile-windows\node\tools\v8_gypfiles\v8_initializers.vcxproj]

node-test-linux-debian12-x64
Exception when executing the batch command : no workspace from node hudson.slaves.DumbSlave[test-softlayer-debian12-x64-1] which is computer hudson.slaves.SlaveComputer@5d7b87a2 and has channel null

I am not sure why Mac tests are failing.

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 29, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 29, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung
Copy link
Member

https://ci.nodejs.org/job/node-test-pull-request/58819/ was orange though it seems the bot is unable to update the status in GitHub properly again...

joyeecheung pushed a commit that referenced this pull request Apr 30, 2024
The V8 WebAssembly trap handler setup for Windows was incorrectly
nested within a POSIX conditional compilation block in src/node.cc.
This caused the related functions to be effectively non-operational
on Windows. The changes involve removing the Windows-specific code from
the POSIX section and correctly placing it under the WIN32 check.
This fix will ensure that the intended exception handling is active
on Windows builds.

Fixes: #52404
Refs: #35033
PR-URL: #52545
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@joyeecheung
Copy link
Member

Landed in 5976985

aduh95 pushed a commit that referenced this pull request Apr 30, 2024
The V8 WebAssembly trap handler setup for Windows was incorrectly
nested within a POSIX conditional compilation block in src/node.cc.
This caused the related functions to be effectively non-operational
on Windows. The changes involve removing the Windows-specific code from
the POSIX section and correctly placing it under the WIN32 check.
This fix will ensure that the intended exception handling is active
on Windows builds.

Fixes: #52404
Refs: #35033
PR-URL: #52545
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misplaced/dead Windows code in node.cc?
5 participants