Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

EPIPE with the repl and cat? #3027

Closed
Closed
@TooTallNate

Description

@TooTallNate

Basically, I'm seeing EPIPE errors when a "large" amount of data gets printed to the output stream when using the repl over pipes. To reproduce, inspect a largish object in the repl, like process or even process.env. This is on OS X, happens on both Terminal and iTerm2.

☮ ~/node (master) ⚡ ./node | cat
> process
{ EventEmitter: [Function: EventEmitter],
  title: './node',
  version: 'v0.7.7-pre',
  assert: [Function],
  config: 
   { target_defaults: 
      { cflags: [],
        default_configuration: 'Release',
        defines: [],
        include_dirs: [],
        libraries: [Object] },
     variables: 
      { host_arch: 'x64',
        node_install_npm: true,
        node_install_waf: true,
        node_prefix: '',
        node_shared_v8: false,
        node_shared_zlib: true,
        node_use_dtrace: false,
        node_use_openssl: true,
        node_use_system_openssl: true,
        strict_aliasing: true,
        target_arch: 'x64',
        v8_use_snapshot: true } },
  moduleLoadList: 
   [ 'Binding evals',
     'Binding natives',
     'NativeModule events',
     'NativeModule buffer',
     'Binding buffer',
     'NativeModule assert',
     'NativeModule util',
     'NativeModule path',
     'NativeModule module',
     'NativeModule tty',
     'NativeModule net',
     'Nativewrite error


events.js:48
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: write EPIPE
    at errnoException (net.js:685:11)
    at Object.afterWrite [as oncomplete] (net.js:510:18)

So that's bad. I've also seen cat print to the screen: cat: write error: Resource temporarily unavailable. Interestingly, if we turn stdin into a pipe as well, then it seems to work over cat (the -i flag on node makes it enter the repl, rather than interpret stdin as a piped-in JS file):

echo process | ./node -i | cat

So this is a little strange to me. Naively, it seems like something possibly on our (libuv?) end, but I really don't know the fine details here.

Another interesting tidbit is that I get essentially the same behavior when running a repl over an HTTP server, connecting using curl. It works seemingly ok, but if you print out process.env for example, then curl crashes with: curl: (23) Failed writing body (0 != 2020). See this gist: https://gist.github.com/2053342

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions