kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: kgio@librelist.com
Subject: Re: kgio_trywrite raises "Broken pipe - send (Errno::EPIPE)"
Date: Tue, 10 Apr 2012 22:56:26 +0200	[thread overview]
Message-ID: <CALiegf=ziL0x=o-5mTKYSfKxA4k5XAPUoBkO-F59M1hRemMwoA@mail.gmail.com> (raw)
In-Reply-To: 20120410201550.GC25426@dcvr.yhbt.net

2012/4/10 Eric Wong <normalperson@yhbt.net>:
> Iñaki Baz Castillo <ibc@aliax.net> wrote:
>> Hi, I've realized that in certain cases Kgio::TCPSocket#kgio_trywrite
>> raises a "Broken pipe - send (Errno::EPIPE)" exception.
>
> EPIPE means the reader got closed or died somehow.  EPIPE is uncommon
> in normal use, but it is fatal and not possible to recover from (unlike
> EAGAIN).

Sure, what I mean is that kgio_trywrite could return :error_epipe so I
would terminate the socket and so :)



> kgio already skips the expensive backtrace generation for
> EPIPE/ECONNRESET since there's nothing the programmer can do about it in
> non-buggy code, though.  (An attacker can trigger EPIPE/ECONNRESET,
> though, so this adds a _small_ amount of DoS protection)

Opss:

  rescue => e
    puts "#{e.class}: #{e.message}"
    puts "backtrace: #{e.backtrace.inspect}"

Result:

  Errno::ECONNRESET: Connection reset by peer - recv> -
  backtrace: ""


Good :)

-- 
Iñaki Baz Castillo
<ibc@aliax.net>

      reply	other threads:[~2012-04-10 20:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 23:00 kgio_trywrite raises "Broken pipe - send (Errno::EPIPE)" Iñaki Baz Castillo
2012-04-09 23:22 ` Iñaki Baz Castillo
2012-04-10 20:15 ` Eric Wong
2012-04-10 20:56   ` Iñaki Baz Castillo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALiegf=ziL0x=o-5mTKYSfKxA4k5XAPUoBkO-F59M1hRemMwoA@mail.gmail.com' \
    --to=ibc@aliax.net \
    --cc=kgio@librelist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).