Skip to content

EPIPE with unix sockets from v4.1.2 #3803

@gramakri

Description

@gramakri

I get intermittent EPIPE with the following code starting from v4.1.2. This code works consistently fine with <= 4.1.1.

var http = require('http');

var data = JSON.stringify({ Cmd: [ 'env' ], AttachStdout: true, AttachStderr: true });

var req = http.request({
    path: '/v1.19/containers/mysql/exec',
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'Content-Length': data.length },
    key: undefined,
    cert: undefined,
    ca: undefined,
    socketPath: '/var/run/docker.sock' }, function () { });

req.on('response', function (res) {
    var chunks = '';
    res.on('data', function(chunk) {
        chunks += chunk;
    });

    res.on('end', function() {
        console.log('Received: %s', chunks);
    });
});

req.on('error', function(error) { console.log(error); });

req.write(data);
req.end();

Test output (this is a continuous shell session):

# /usr/local/node-4.1.0/bin/node test.js 
Received: {"Id":"879a1923b1b9c0645e062f4b66b34d89678eaee098007989faf0b3bdd25be88c"}

#/usr/local/node-4.1.1/bin/node test.js
Received: {"Id":"220d1a2fdf0ed970e49f0df8a81763ec83783c88cab3a8dbd0dbe83152a02ec3"}

#/usr/local/node-4.1.2/bin/node test.js
{ [Error: write EPIPE]
  code: 'EPIPE',
  errno: 'EPIPE',
  syscall: 'write',
  address: undefined }

#/usr/local/node-4.2.1/bin/node test.js
Received: {"Id":"8ae4fd9dea746c52f9d7d6675a2556b13e48c49ee714b3ba2950974a5c619e70"}

#/usr/local/node-4.2.1/bin/node test.js
{ [Error: write EPIPE]
  code: 'EPIPE',
  errno: 'EPIPE',
  syscall: 'write',
  address: undefined }

#/usr/local/node-4.2.2/bin/node test.js
{ [Error: write EPIPE]
  code: 'EPIPE',
  errno: 'EPIPE',
  syscall: 'write',
  address: undefined }

#/usr/local/node-5.0.0/bin/node test.js
{ [Error: write EPIPE]
  code: 'EPIPE',
  errno: 'EPIPE',
  syscall: 'write',
  address: undefined }

#/usr/local/node-4.1.0/bin/node test.js
Received: {"Id":"49d97ac0920cad11956ac795032df2ec6d38b13f144f0f3c0875f574926b4e7e"}

#/usr/local/node-4.1.0/bin/node test.js
Received: {"Id":"9c2035823fd5d0cfc8dd12a8466b8a7643c3e6721729002905f4b1bd33a56156"}

Note how the request works intermittently for >= 4.1.2. If I run it 10 times, it will fail 8 times. But it consistently works below 4.1.1.

The above example was derived from https://github.com/apocas/docker-modem/blob/master/lib/modem.js#L156 (@apocas). I hit this error consistently with dockerode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    netIssues and PRs related to the net subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions