GithubHelp home page GithubHelp logo

Comments (6)

kamilmysliwiec avatar kamilmysliwiec commented on April 28, 2024 1

IMO even the 512 MB setting is much more than needed. We could keep it this high though just to avoid introducing another configuration option.

from nest.

kamilmysliwiec avatar kamilmysliwiec commented on April 28, 2024

TCP microservices should never be exposed as public services so there's no risk of anyone sending malicious data.

Still, we should fix this issue either way. Would you like to create a PR for this?

from nest.

raw-phil avatar raw-phil commented on April 28, 2024

@kamilmysliwiec sure I'd like to create a PR, I just don't know how big the maximum size needs to be set for incoming json message. Maybe to the max string size of V8 engine, that if I remember correctly is 1GB.

from nest.

underfisk avatar underfisk commented on April 28, 2024

@raw-phil I would say that it could be adjustable, the developer might want to specify whatever value he has in mind as sometimes it's hard to accurately read the value. Applying the default based on the max string for v8 engine could work but allowing the developer to override should be possible 🤔

from nest.

raw-phil avatar raw-phil commented on April 28, 2024

@kamilmysliwiec I agree with you. In the next days I'll work on the PR. Thanks

from nest.

raw-phil avatar raw-phil commented on April 28, 2024

I have noticed that the length used before the delimiter character(#) represents the number of characters sent instead of the bytes of the message.

private formatMessageData(message: any) {
const messageData = JSON.stringify(message);
const length = messageData.length;
const data = length + this.delimiter + messageData;
return data;
}

I've done a couple of researches, and JS use the UTF-16 encoding which is variable-length, code points are encoded with one or two 16-bit code units.
IMO, if we want to set the maximum string/buffer size to 512MB, we have to consider the worst case where all characters need 32 bits to be encoded, and then I think that the maximum length (in characters) of the message should be set to 512MB / 32 bit = 134217728, or something like that

from nest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.