Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Increase the size of the decoder buffer to 1meg. #73

Closed
wants to merge 1 commit into from

Conversation

mikeal
Copy link
Contributor

@mikeal mikeal commented Jul 3, 2018

The current default is far too small, it's breaking on a node I have that is only 66015 bytes.

The current default is far too small, it's breaking on a node I have that is only 66015 bytes.
Copy link
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

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

Commit message didn't lint. You miss the prefix, so it would be: fix: increase ....

@@ -30,7 +30,8 @@ const decoder = new cbor.Decoder({
val = val.slice(1)
return {'/': val}
}
}
},
size: 1e+6 /* one megabyte */
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the implementation, it tries to use power of two. So it make make sense to write is as size: 1024 * 1024 * 1024 (which I find easier to read, but that's a matter of taste).

@daviddias daviddias added the status/in-progress In progress label Aug 25, 2018
@vmx
Copy link
Member

vmx commented Nov 14, 2018

@mikeal I guess you still want this in?

@mikeal
Copy link
Contributor Author

mikeal commented Nov 19, 2018

@vmx the default should definitely be larger, but it's not clear to me how much larger. Because of the way CBOR is implemented it requires a static allocation of memory of double the max node size so there will be tradeoffs on increasing it as well.

@vmx
Copy link
Member

vmx commented Nov 20, 2018

Should we make the default to a value that Bitswap can still transfer, hence 4MB (see #52 for more discussions on that topic).

rvagg added a commit that referenced this pull request Mar 22, 2019
* Introduce some sanity / safety checking to configureDecoder()
* Attempting to decode a block larger than the decoder can handle will
  result in growing the decoder heap

Fixes: #73
rvagg added a commit that referenced this pull request Apr 1, 2019
* Introduce some sanity / safety checking to configureDecoder()
* Attempting to decode a block larger than the decoder can handle will
  result in growing the decoder heap

Fixes: #73
@vmx vmx closed this in 1f7b7f1 Apr 1, 2019
@ghost ghost removed the status/in-progress In progress label Apr 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants