Skip to content

buffer: fix assertion error in WeakCallback - #3329

Closed
indutny wants to merge 2 commits into
nodejs:masterfrom
indutny:fix/buffer-free-callback-regr
Closed

buffer: fix assertion error in WeakCallback#3329
indutny wants to merge 2 commits into
nodejs:masterfrom
indutny:fix/buffer-free-callback-regr

Conversation

@indutny

Copy link
Copy Markdown
Member

CallbackInfo is now bound to ArrayBuffer instance, not Uint8Array,
therefore SPREAD_ARG will abort with:

Assertion failed: ((object)->IsUint8Array())

Make changes necessary to migrate it to ArrayBuffer.

See: #3080 (comment)

R=@trevnorris

`CallbackInfo` is now bound to `ArrayBuffer` instance, not `Uint8Array`,
therefore `SPREAD_ARG` will abort with:
Assertion failed: ((object)->IsUint8Array())
Make changes necessary to migrate it to `ArrayBuffer`.
See: nodejs#3080 (comment)
@indutnyindutny mentioned this pull request Oct 12, 2015
@indutny

Copy link
Copy Markdown
MemberAuthor

Comment threadsrc/node_buffer.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@TooTallNate has mentioned how some use a zero-length buffer to keep track of things in their modules. A zero-length buffer would be nullptr. Instead should be like:

if (obj_c.Length() > 0) CHECK_NE(obj_data, nullptr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

might want to add a test for this case as well.

@trevnorris

Copy link
Copy Markdown
Contributor

Left 2 comments. Other than that, LGTM

@indutny

Copy link
Copy Markdown
MemberAuthor

@trevnorris fixed!

@trevnorris

Copy link
Copy Markdown
Contributor

LGTM

@indutny

Copy link
Copy Markdown
MemberAuthor

@mikemorris may I ask you to give a try to this patch? Does it fix problem for you?

@mscdexmscdex added the buffer Issues and PRs related to the buffer subsystem. label Oct 12, 2015
@mikemorris

Copy link
Copy Markdown

@indutny Looks like that fixed it, thanks for the quick response @indutny!

@indutny

Copy link
Copy Markdown
MemberAuthor

Great, thank you for confirming this! cc @jasnell

indutny added a commit that referenced this pull request Oct 13, 2015
`CallbackInfo` is now bound to `ArrayBuffer` instance, not `Uint8Array`,
therefore `SPREAD_ARG` will abort with:
Assertion failed: ((object)->IsUint8Array())
Make changes necessary to migrate it to `ArrayBuffer`.
See: #3080 (comment)
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: #3329
@jasnell

Copy link
Copy Markdown
Member

Landed in 931118c

indutny added a commit that referenced this pull request Oct 13, 2015
`CallbackInfo` is now bound to `ArrayBuffer` instance, not `Uint8Array`,
therefore `SPREAD_ARG` will abort with:
Assertion failed: ((object)->IsUint8Array())
Make changes necessary to migrate it to `ArrayBuffer`.
See: #3080 (comment)
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: #3329
@jasnell

Copy link
Copy Markdown
Member

Landed in v4.x in b3cbd13

@jasnelljasnell closed this Oct 13, 2015
jasnell added a commit that referenced this pull request Oct 13, 2015
* Includes fixes for two regressions
- Assertion error in WeakCallback - see [#3329](#3329)
- Undefined timeout regression - see [#3331](#3331)
jasnell added a commit that referenced this pull request Oct 13, 2015
* Includes fixes for two regressions
- Assertion error in WeakCallback - see [#3329](#3329)
- Undefined timeout regression - see [#3331](#3331)
jasnell added a commit that referenced this pull request Oct 13, 2015
* Includes fixes for two regressions
- Assertion error in WeakCallback - see [#3329](#3329)
- Undefined timeout regression - see [#3331](#3331)
* Document an additional known issue with pipelined requests
- See: #3332 and #3342
jasnell added a commit that referenced this pull request Oct 13, 2015
* Includes fixes for two regressions
- Assertion error in WeakCallback - see [#3329](#3329)
- Undefined timeout regression - see [#3331](#3331)
* Document an additional known issue with pipelined requests
- See: #3332 and #3342
jasnell added a commit that referenced this pull request Oct 13, 2015
* Includes fixes for two regressions
- Assertion error in WeakCallback - see [#3329](#3329)
- Undefined timeout regression - see [#3331](#3331)
* Document an additional known issue with pipelined requests
- See: #3332 and #3342
slice = null;
gc();
gc();
gc();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's unclear to me why calling gc() three times is required here. @indutny Sorry to pull this up from more than 3 years ago, but do you remember why?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bufferIssues and PRs related to the buffer subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@indutny@trevnorris@mikemorris@jasnell@Trott@mscdex@MylesBorins