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

buffer error: kMaxLength #47

Closed
reqshark opened this issue Feb 20, 2015 · 14 comments
Closed

buffer error: kMaxLength #47

reqshark opened this issue Feb 20, 2015 · 14 comments
Labels

Comments

@reqshark
Copy link
Collaborator

running the test suite on osx and linux i get a buffer triggered assertion crap out on survey.js.

also wondering why tape is zero for zero when t.plan(4) :

ok survey.js ........................ 0/0
TAP version 13
Assertion failed: (length <= kMaxLength), function New, 
file ../src/node_buffer.cc, line 145.
@reqshark reqshark added the bug label Feb 20, 2015
@nickdesaulniers
Copy link
Owner

From current master c476019 or with #46 applied? The test does not timeout for me on OSX 10.8.5 c476019.

@reqshark
Copy link
Collaborator Author

its on current master, and it's not a timeout, but scroll up to the results on to see survey.js after you get:

total ........................... 806/806

ok

@nickdesaulniers
Copy link
Owner

ok survey.js ........................ 4/4
TAP version 13

@reqshark
Copy link
Collaborator Author

dont see the assertion error on node 10.. using osx yosemite. still 0/0, but silent as to why

linux assertion error is different, points at node::Environment*, whereas i'm not seeing that on yosemite.

linux:

ok survey.js ........................ 0/0
TAP version 13
node: ../src/node_buffer.cc:121: v8::Local<v8::Object> node::Buffer::New(node::Environment*, size_t): Assertion `(length) <= (kMaxLength)' failed.

is darwin 10.8.5 is that much different?

btw running from commit c476019

@nickdesaulniers
Copy link
Owner

If I upgrade to node v0.12.0 from v0.10.26 I see this.

ok survey.js ........................ 0/0
TAP version 13
Assertion failed: (length <= kMaxLength), function New, file ../src/node_buffer.cc, line 145.

@nickdesaulniers
Copy link
Owner

I wonder where node_buffer.cc is?

@nickdesaulniers
Copy link
Owner

Also, I bet we shouldn't be using uint32's somewhere:
nodejs/node-v0.x-archive#4331

@nickdesaulniers
Copy link
Owner

@nickdesaulniers
Copy link
Owner

I should be able to run that one test individually with ./node_modules/.bin/tapr test/survey.js.

@nickdesaulniers
Copy link
Owner

It's definitely this line that is triggering it:

var msg = nn.Recv(this.binding, 0);

@nickdesaulniers
Copy link
Owner

it fails because len is -1:

v8::Local<v8::Value> h = NanNewBufferHandle(len);

@nickdesaulniers
Copy link
Owner

ah, this patch removed a necessary check c0336f1 cc @reqshark

reqshark added a commit that referenced this issue Feb 20, 2015
fixes #47 with a
necessary check removed in
c0336f19cd6376607
31f32911d1f31b09e6f7f8f

• if nn_recv() errors setting len to -1, node buffer library will
accordingly refuse to allocate (malloc or smalloc) an impossible size
in memory
@reqshark
Copy link
Collaborator Author

fixed c50541c

@reqshark
Copy link
Collaborator Author

@nickdesaulniers good catch!

reqshark added a commit that referenced this issue Feb 24, 2015
sockopt API

• convenience methods for `get/setsockopt()`

an interface to nanomsg socket options by way of:

`socket.option(param)` or `socket.option()`

passing a param sets that, while no param gets that.

*a few caveats will be referenced in forthcoming docs

it’s the simple interface i wrote in nanomsg.iojs covering:

• tcpnodelay
• linger
• sndbuf
• rcvbuf
• sndtimeo
• rcvtimeo
• reconn
• maxreconn
• sndprio
• rcvprio

test: socket.tcpnodelay(boolean)

document the api

opts initializer

also added some semicolons

add note on address strings

act like a getter, not a setter

delete var domain

test: sockoptapi.js semicolons

docs: update raw opt

use more nn.Err()

remove nn.Strerr() C++ function, use nn.Err()

maintain byte length check during nn_recv() operation

fixes #47 with a
necessary check removed in
c0336f19cd6376607
31f32911d1f31b09e6f7f8f

• if nn_recv() errors setting len to -1, node buffer library will
accordingly refuse to allocate (malloc or smalloc) an impossible size
in memory

test: set sockopts when starting the socket

unorthodox symbol fix: rvcprio()

opval

dry it out a bit

docs: rcvbuf and sndbuf unit is size in bytes

adding Makefile

after pulling down run git submodule update - -init:

when building the repo on unix for node/iojs versions just go:

nvm use $VERSION && make full

make full removes the build and node_modules directory first
then it rebuilds the project compiling sources
then it runs the test suite.

if you only want to rebuild for a different version just go:
make clean && make

we’ll probably want to uncomment the perf stuff once that’s setup

docs: the Makefile

docs: move contributing under test section

js: put sockopt API methods onto Socket prototype

js: line up the o's (ocd)

docs: also add size in bytes to top links

js: partial function application & test: RCVPRIO

• adds TODO: Issue #50 comment on line 19
• rewrite opts check for RAW & remove redundant error check
  - RAW option now more consistent with its description in docs
• partial function application: tighten up opts API methods
• test: RCVPRIO, ensure symbol test fails for the missing symbol

js: clean up, opt function context

minor bump

bump version
reqshark added a commit that referenced this issue Feb 24, 2015
• convenience methods for `get/setsockopt()`, an interface to nanomsg socket options by way of:

`socket.option(param)` or `socket.option()`

passing a param sets that, while no param gets that. it’s the simple interface i wrote in nanomsg.iojs covering:
  - tcpnodelay
  - linger
  - sndbuf
  - rcvbuf
  - sndtimeo
  - rcvtimeo
  - reconn
  - maxreconn
  - sndprio
  - rcvprio

• adds documentation
• fixes #47 with a necessary check removed in c0336f1
• if nn_recv() errors setting len to -1, node buffer library will accordingly refuse to allocate (malloc or smalloc) an impossible size in memory
• test: set sockopts when starting the socket
• unorthodox symbol fix: rvcprio()
• the Makefile
• adds TODO: Issue #50 comment on line 19
• rewrite opts check for RAW & remove redundant error check
  - RAW option now more consistent with its description in docs
• partial function application: tighten up opts API methods
• test: RCVPRIO, ensure symbol test fails for the missing symbol
• bump version
reqshark added a commit that referenced this issue Feb 24, 2015
• convenience methods for `get/setsockopt()`, an interface to nanomsg socket options by way of:

`socket.option(param)` or `socket.option()`

passing a param sets that, while no param gets that. it’s the simple interface i wrote in nanomsg.iojs covering:
  - tcpnodelay
  - linger
  - sndbuf
  - rcvbuf
  - sndtimeo
  - rcvtimeo
  - reconn
  - maxreconn
  - sndprio
  - rcvprio

• adds documentation
• fixes #47 with a necessary check removed in c0336f1
• if nn_recv() errors setting len to -1, node buffer library will accordingly refuse to allocate (malloc or smalloc) an impossible size in memory
• test: set sockopts when starting the socket
• unorthodox symbol fix: rvcprio()
• the Makefile
• adds TODO: Issue #50 comment on line 19
• rewrite opts check for RAW & remove redundant error check
  - RAW option now more consistent with its description in docs
• partial function application: tighten up opts API methods
• test: RCVPRIO, ensure symbol test fails for the missing symbol
• bump version

PR: #46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants