Git Product home page Git Product logo

Comments (2)

applmak avatar applmak commented on May 2, 2024

This is even weirder than I thought: sometimes we fails to connect between the client & the server. After EXTENSIVE digging, I figured out that this is happening due to our abuse of the namespace protocol of socket.io. The namespace criteria itself is undocumented; I deduced that it couldn't have certain special characters like ',' in them, and constructed a namespace that I thought looked reasonable (e.g. '/module0X0X1920X1080X0', which is '/module' + rect + module deadline). In order to avoid a second round-trip, we actually connect to a namespace with additional data tacked on like a URL (e.g. /module0X0X1920X1080X0?id=0,0,1920,1080-0&rect=0,0,1920,1080), which seemed to work just fine in my testing. However, the actual code that parses a response on the server from the client looks like this:

p.nsp = '';
while (++i) {
  var c = str.charAt(i);
  if (',' == c) break;
  p.nsp += c;
  if (i == str.length) break;
}

and then attempt to json decode the rest of the string-form of the packet. At first glance, this should never work, but it turns out for certain values of deadline, this parses perfectly, allowing the client & server modules to communicate. I've been poking around with changing the meaning of things like 'deadline' and when doing so, this bug appeared, which causes the CONNECT packet to be unparseable and dropped, leading to the module halves being unable to communicate with each other.

The fix is to not abuse the namespace in this way, and require a second round-trip to transfer id and rect, OR, allow the namespace to be parsed back to id and rect. The former introduces a new 'pending' state for client connections, which sounds hard, so I'll be preferring the latter approach.

from chicago-brick.

applmak avatar applmak commented on May 2, 2024

Done in #273.

from chicago-brick.

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.