GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vm: refactor to use more primordials by aduh95 · Pull Request #36023 · nodejs/node

Conversation

@aduh95

@aduh95 aduh95 commented Nov 7, 2020

Copy link
Copy Markdown
Contributor
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and ExE-Boss reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@aduh95
vm: refactor to use more primordials
5ec0e19
@nodejs-github-bot nodejs-github-bot added the vm Issues and PRs related to the vm subsystem. label Nov 7, 2020
@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2020
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 7, 2020
@nodejs-github-bot

This comment has been minimized.

Sign in to view
Trott
Trott approved these changes Nov 7, 2020
View reviewed changes
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Nov 7, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/34182/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Nov 7, 2020
@aduh95 aduh95 mentioned this pull request Nov 8, 2020
tools,lib: recommend using safe primordials #36026
Closed
3 tasks done
@aduh95 aduh95 added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 14, 2020
@github-actions github-actions Bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 14, 2020
@github-actions

github-actions Bot commented Nov 14, 2020

Copy link
Copy Markdown
Contributor

Landed in 8297860...1d02a35

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nodejs-github-bot pushed a commit that referenced this pull request Nov 14, 2020
@aduh95 @nodejs-github-bot
vm: refactor to use more primordials
1d02a35
PR-URL: #36023
Reviewed-By: Rich Trott <[email protected]>
@github-actions github-actions Bot closed this Nov 14, 2020
@aduh95
aduh95 deleted the vm-primordials branch November 14, 2020 14:49
codebytere pushed a commit that referenced this pull request Nov 22, 2020
@aduh95 @codebytere
vm: refactor to use more primordials
f7b2fce
PR-URL: #36023
Reviewed-By: Rich Trott <[email protected]>
@codebytere codebytere mentioned this pull request Nov 22, 2020
v15.3.0 proposal #36232
Merged
BethGriggs pushed a commit that referenced this pull request Dec 9, 2020
@aduh95 @BethGriggs
vm: refactor to use more primordials
c677427
PR-URL: #36023
Reviewed-By: Rich Trott <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 10, 2020
@aduh95 @BethGriggs
vm: refactor to use more primordials
ff979e3
PR-URL: #36023
Reviewed-By: Rich Trott <[email protected]>
@BethGriggs BethGriggs mentioned this pull request Dec 10, 2020
v14.15.2 proposal #36476
Merged
BethGriggs pushed a commit that referenced this pull request Dec 15, 2020
@aduh95 @BethGriggs
vm: refactor to use more primordials
1906f19
PR-URL: #36023
Reviewed-By: Rich Trott <[email protected]>
@rubenstolk

rubenstolk commented Dec 17, 2020

Copy link
Copy Markdown

Great - an automatic upgrade from 14.15.1 to 14.15.2 started crashing our production environment. Lesson learnt, don't accept minor updates from Node just like that...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Dec 17, 2020

Copy link
Copy Markdown
Contributor Author

@rubenstolk Do you want to open an issue describing the bug?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rubenstolk

rubenstolk commented Dec 17, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@aduh95 I don't know if it's a bug. While running this inside a vm script:

(req) { // an express request object
  const dummyReq = { ...req, model: undefined }; // create a copy of `req` with some modifications
  // Here dummyReq.headers has become undefined
}

This piece of code has been working for years, but since 14.15.2 the dummyReq doesn't have headers anymore...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rubenstolk

rubenstolk commented Dec 17, 2020

Copy link
Copy Markdown

Hmm looking deeper into this, I don't think it has to do with the vm, I made an assumption here. The behavior is also there when running outside of vm.

aduh95 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Dec 17, 2020

Copy link
Copy Markdown
Contributor Author

@rubenstolk I'm not able to reproduce the bug:

$ node --version
v14.15.2
$ node -p 'new vm.Script("\
const req = { headers: { headerKey: `value` }, method : `value` };\
const dummy = { ...req, method: undefined };\
dummy.headers\
").runInNewContext()'
{ headerKey: 'value' }

I'm seeing the expected { headerKey: 'value' } on stdout…

Opening a new issue would make your problem likely to be fixed quicker as more people would notice the issue and help fix it – only people already subscribed to this thread are seeing our messages here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rubenstolk

rubenstolk commented Dec 17, 2020

Copy link
Copy Markdown

@aduh95 this is what fails, so it's NOT because of vm:

require('http').createServer((req, res) => {
  const dummyReq = { ...req };
  console.log(!!req.headers, !!dummyReq.headers);
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('ok');
}).listen(8000);
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ExE-Boss

ExE-Boss commented Dec 17, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@rubenstolk
Do note that object spread only copies own enumerable properties, e.g.:

const result = { 
	...(Object.create(
		{
			prototypeProperty: "foo",
		},
		{
			nonEnumerableProperty: {
				configurable: true,
				enumerable: false,
				writable: true,
				value: 123,
			}
		}
	)),
};

Results in an empty object with a prototype of Object.prototype.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rubenstolk

rubenstolk commented Dec 17, 2020

Copy link
Copy Markdown

Let's continue the conversation here: #36550, would be interested to understand why the behavior has changed @ExE-Boss !

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rubenstolk rubenstolk mentioned this pull request Dec 17, 2020
Object.assign / spread of http request object difference between v14.15.1 and v14.15.2 #36550
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Trott Trott Trott approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. vm Issues and PRs related to the vm subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@aduh95 @nodejs-github-bot @rubenstolk @ExE-Boss @Trott
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.