Skip Menu |

This queue is for tickets about the Net-Proxy-Type CPAN distribution.

Report information
The Basics
Id: 81396
Status: resolved
Priority: 0/
Queue: Net-Proxy-Type

People
Owner: Nobody in particular
Requestors: blue [...] thisisnotmyrealemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: $SIG{PIPE} needs to be handled
I was looping through a list of proxies using Net::Proxy::Type to check them and the program would randomly quit with no error message and perl would exit with an exit code of 0. After much experimentation, I found that adding this to my program fixed the problem: $SIG{PIPE} = 'IGNORE'. Because Net::Proxy::Type is writing to sockets shouldn't it be catching the error that the connection might have been closed?
On Fri Nov 23 23:18:06 2012, blue wrote: Show quoted text
> I was looping through a list of proxies using Net::Proxy::Type to check > them and the program would randomly quit with no error message and perl > would exit with an exit code of 0. After much experimentation, I found > that adding this to my program fixed the problem: $SIG{PIPE} =
'IGNORE'. Show quoted text
> Because Net::Proxy::Type is writing to sockets shouldn't it be catching > the error that the connection might have been closed?
Do you have reproducible test? What operating system do you use? As I see writing to closed socket checked correctly: at line 411 (https://metacpan.org/source/OLEG/Net-Proxy-Type- 0.06/lib/Net/Proxy/Type.pm#L411)
From: blue [...] thisisnotmyrealemail.com
On Sat Nov 24 00:59:22 2012, OLEG wrote: Show quoted text
> On Fri Nov 23 23:18:06 2012, blue wrote:
Show quoted text
> Do you have reproducible test? What operating system do you use? > As I see writing to closed socket checked correctly: at line 411 > (https://metacpan.org/source/OLEG/Net-Proxy-Type- > 0.06/lib/Net/Proxy/Type.pm#L411)
It took me several days to find the workaround, so I don't have any time left now to create a reproducible test case. I am running this on Mac OSX. This stackoverflow answer says EAGAIN should also be checked: http://stackoverflow.com/a/7003379s
I added few tests for sigpipe. Can you test last version from repository: https://github.com/olegwtf/p5-Net-Proxy-Type.git? "make test" or "prove -l" On my system all test successful.
From: blue [...] thisisnotmyrealemail.com
On Sat Nov 24 09:03:41 2012, OLEG wrote: Show quoted text
> I added few tests for sigpipe. Can you test last version from repository: > https://github.com/olegwtf/p5-Net-Proxy-Type.git? > "make test" or "prove -l" > On my system all test successful.
The tests work for me, but I also got it to pass when removing the EAGAIN checks, so that's probably not what caused the problem for me. I added $SIG{PIPE} = sub { Carp::confess 'SIGPIPE' } to my script and have attached the stacktrace it produced when it finally occurred again after a couple of hours.
Subject: stacktrace.txt
SIGPIPE at ./bot.pl line 43. main::__ANON__('PIPE') called at /perl/lib/5.16.2/darwin-2level/IO/Handle.pm line 477 eval {...} called at /perl/lib/5.16.2/darwin-2level/IO/Handle.pm line 477 IO::Handle::syswrite('IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 402 Net::Proxy::Type::_write_to_socket('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 'IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 278 Net::Proxy::Type::is_socks4('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 160.79.35.27, 80) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 151 Net::Proxy::Type::get('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7, undef) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 171 Net::Proxy::Type::get_as_string('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7) called at ./bot.pl line 566 Bot::test_proxy('Bot=HASH(0x7f90b0b7aad0)', 160.79.35.27, 80) called at ./bot.pl line 483 Bot::find_proxy('Bot=HASH(0x7f90b0b7aad0)') called at ./bot.pl line 249 Bot::run('Bot=HASH(0x7f90b0b7aad0)') called at ./bot.pl line 43. main::__ANON__('PIPE') called at /perl/lib/5.16.2/darwin-2level/IO/Handle.pm line 477 eval {...} called at /perl/lib/5.16.2/darwin-2level/IO/Handle.pm line 477 IO::Handle::syswrite('IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 402 Net::Proxy::Type::_write_to_socket('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 'IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 278 Net::Proxy::Type::is_socks4('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 160.79.35.27, 80) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 151 Net::Proxy::Type::get('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7, undef) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 171 Net::Proxy::Type::get_as_string('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7) called at ./bot.pl line 566 Bot::test_proxy('Bot=HASH(0x7f90b0b7aad0)', 160.79.35.27, 80) called at ./bot.pl line 483 Bot::find_proxy('Bot=HASH(0x7f90b0b7aad0)') called at ./bot.pl line 249 Bot::run('Bot=HASH(0x7f90b0b7aad0)') called at /perl/lib/5.16.2/darwin-2level/IO/Handle.pm line 477. IO::Handle::syswrite('IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 402 Net::Proxy::Type::_write_to_socket('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 'IO::Socket::INET=GLOB(0x7f90b18eb310)', '\x{4}\x{1}\x{0}PJ}\x{e0}\x{b2}\x{0}') called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 278 Net::Proxy::Type::is_socks4('Net::Proxy::Type=HASH(0x7f90b0b944b0)', 160.79.35.27, 80) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 151 Net::Proxy::Type::get('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7, undef) called at /perl/lib/site_perl/5.16.1/Net/Proxy/Type.pm line 171 Net::Proxy::Type::get_as_string('Net::Proxy::Type=HASH(0x7f90b0b944b0)', '160.79.35.27:80', 7) called at ./bot.pl line 566 Bot::test_proxy('Bot=HASH(0x7f90b0b7aad0)', 160.79.35.27, 80) called at ./bot.pl line 483 Bot::find_proxy('Bot=HASH(0x7f90b0b7aad0)') called at ./bot.pl line 249 Bot::run('Bot=HASH(0x7f90b0b7aad0)') called at ./bot.pl line 49
From: blue [...] thisisnotmyrealemail.com
On Sat Nov 24 14:01:27 2012, blue wrote: Show quoted text
> On Sat Nov 24 09:03:41 2012, OLEG wrote:
> > I added few tests for sigpipe. Can you test last version from
repository: Show quoted text
> > https://github.com/olegwtf/p5-Net-Proxy-Type.git? > > "make test" or "prove -l" > > On my system all test successful.
> > The tests work for me, but I also got it to pass when removing the > EAGAIN checks, so that's probably not what caused the problem for me. I > added $SIG{PIPE} = sub { Carp::confess 'SIGPIPE' } to my script and have > attached the stacktrace it produced when it finally occurred again after > a couple of hours.
I get the same stacktrace when I use the updated version from your git repo.
On Sat Nov 24 19:37:24 2012, blue wrote: Show quoted text
> On Sat Nov 24 14:01:27 2012, blue wrote:
> > On Sat Nov 24 09:03:41 2012, OLEG wrote:
> > > I added few tests for sigpipe. Can you test last version from
> repository:
> > > https://github.com/olegwtf/p5-Net-Proxy-Type.git? > > > "make test" or "prove -l" > > > On my system all test successful.
> > > > The tests work for me, but I also got it to pass when removing the > > EAGAIN checks, so that's probably not what caused the problem for
me. I Show quoted text
> > added $SIG{PIPE} = sub { Carp::confess 'SIGPIPE' } to my script and
have Show quoted text
> > attached the stacktrace it produced when it finally occurred again
after Show quoted text
> > a couple of hours.
> > I get the same stacktrace when I use the updated version from your git
repo. Ok, I just uploaded version 0.07 with fix for this bug