Skip to content

Client connect().on('data', .... terminates early when receiving large packets #11

@RileyRaschke

Description

@RileyRaschke

I think this bug may be a feature from inheriting EventEmitter but i haven't got to dig that far just yet.

A working scenario that runs until terminated:

const NetcatClient = require('netcat/client');
const { spawn } = require('child_process');
// Bad example; made zombies - SORRY!!
//var child = spawn('bash', ['-c','cat /dev/urandom | base64 | nc -l -U /tmp/test.sock']); 
var nc = new NetcatClient();
/**
 * This works! Runs until interrupted as expected
 */
nc.enc('utf8').unixSocket('/tmp/test.sock').connect().pipe(process.stdout);

Chunked data terminates early without error/reason:

const NetcatClient = require('netcat/client');
const { spawn } = require('child_process');
// Bad example; made zombies - SORRY!!
//var child = spawn('bash', ['-c','cat /dev/urandom | /usr/bin/base64 | /bin/nc -l -U /tmp/test.sock']); 
var nc = new NetcatClient();
/**
 * This terminates early?!? (and silently?)
 */
nc.enc('utf8').unixSocket('/tmp/test.sock').connect()
  .on('data', (chunk) => {
    process.stdout.write(chunk);
  });

Going to take a break and come back to this one. Will follow up if i find the issue or the correct implementation to achieve an endless stream of chunked data. The child process above will hang but you can always start up an external listener/feed as well to remove that side effect of the test case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions