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

js-libp2p@0.37.3 does not support chunks bigger than 2Mb anymore #1343

Closed
alxroyer opened this issue Aug 11, 2022 · 5 comments
Closed

js-libp2p@0.37.3 does not support chunks bigger than 2Mb anymore #1343

alxroyer opened this issue Aug 11, 2022 · 5 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@alxroyer
Copy link

alxroyer commented Aug 11, 2022

  • Version: js-libp2p@0.37.3 (vs js-libp2p@0.36.2)
  • Platform: Windows + node v16.13.2
  • Subsystem: @libp2p/mplex? (to be confirmed)

Severity:

Low

Description:

When receiving chunks of data bigger than 2Mb from a stream, Error: message size too large! errors are raised,
while with js-libp2p@0.36.2, we could exchange chunks of 10Mb at least.

Not really an operational problem I guess. Quick workarounds easy to set up.
But depending on the root cause, I can't say on my own whether that problem could hide a bigger one.

Steps to reproduce the error:

Using the scripts attached with #1342, launch the sender (3145728 = 3 * 1024 * 1024):

node libp2p-node.0.37.x.mjs --send=path-to-a-big-file --size=3145728

then launch the receiver:

node libp2p-node.0.37.x.mjs --connect=/address/of/sender/node

Error displayed by the receiver:

file:///.../node_modules/@libp2p/mplex/dist/src/restrict-size.js:14
            throw Object.assign(new Error('message size too large!'), { code: 'ERR_MSG_TOO_BIG' });
                                ^

Error: message size too large!
    at checkSize (file:///.../node_modules/@libp2p/mplex/dist/src/restrict-size.js:14:33)
    at Array.forEach (<anonymous>)
    at restrictSize (file:///.../node_modules/@libp2p/mplex/dist/src/restrict-size.js:21:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///.../node_modules/@libp2p/mplex/dist/src/mplex.js:134:38
    at async MplexStreamMuxer.sink (file:///.../node_modules/@libp2p/mplex/dist/src/mplex.js:133:17) {
  code: 'ERR_MSG_TOO_BIG'
}
@alxroyer alxroyer added the need/triage Needs initial labeling and prioritization label Aug 11, 2022
@alxroyer
Copy link
Author

For the info, I came up through this while measuring the impact of chunk sizes on transfer rates, which gave me the graph below:

p2p902-2022-08-11a

We can see on this graph that orange dots (js-libp2p@0.37.3) stop at 2Mb, while blue dots go up to 10Mb.

@mpetrunic
Copy link
Member

You scripts are initializing Mplex with default max message size value, you should set it to something higher:
https://github.com/libp2p/js-libp2p-mplex/blob/v1.1.2/src/index.ts#L11

@mpetrunic
Copy link
Member

@Alexis-ROYER

@alxroyer
Copy link
Author

Thanks for the info @mpetrunic.

To compare with the Mplex coming along with js-libp2p@0.36.2 (libp2p-mplex@0.10.7 on my side):

  • I guess it means that the default max message size was different?
  • Or possibly this max message size limit did not exist?

@mpetrunic
Copy link
Member

Not sure honestly. maybe something was overriding that limit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants