develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000421.005] Broken pipe when connecting a IO::Socket::INETto an invalid port on a valid host

From:
oberpwd
Date:
April 21, 2000 15:37
Subject:
[ID 20000421.005] Broken pipe when connecting a IO::Socket::INETto an invalid port on a valid host
Message ID:
200004212237.RAA26774@truck.network.com

This is a bug report for perl from oberpwd@truck.network.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]
When connecting a IO::Socket::INET socket to an invalid port on a valid host,
Perl-5.6.0 dies abruptly with a "Broken pipe". Here is a sample of code that
causes the error on my system:

use IO::Socket::INET;

my($host, $port, $timeout) = ('nsplab14.network.com', '8080', '180'); 

my $sock = IO::Socket::INET->new('PeerAddr' => $host,
				 'PeerPort' => $port,
				 'Proto'    => 'tcp',
				 'Timeout'  => $timeout);

If the host is invalid this code will return undef like it is supposed to. If
all is well, the socket also works fine, but if the port is invalid that is when
the "Broken pipe" occurs (This works fine with Perl5.005_03 on my system).

I've traced the code and the pipe breaks when the line

return scalar(%arg) ? $sock->configure(\%arg) : $sock;

is executed inside of IO::Socket->new() (Particulary the 
$sock->configure(\%arg) part).

Your welcome.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=critical
---
Site configuration information for perl v5.6.0:

Configured by oberpwd at Fri Apr 21 14:19:21 CDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos truck 5.5.1 generic_103640-27 sun4u sparc sunw,ultra-1 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
    cppflags='-fno-strict-aliasing -I/home/anubis22/oberpwd/gnu/include'
    ccflags ='-fno-strict-aliasing -I/home/anubis22/oberpwd/gnu/include '
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-L/home/anubis22/oberpwd/gnu/lib -L/lib -L/usr/lib -L/usr/ccs/lib '
    libpth=/home/anubis22/oberpwd/gnu/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/home/anubis22/oberpwd/gnu/lib -L/lib -L/usr/lib -L/usr/ccs/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /home/anubis/oberpwd/perl-5.6.0/lib/5.6.0/sun4-solaris
    /home/anubis/oberpwd/perl-5.6.0/lib/5.6.0
    /home/anubis/oberpwd/perl-5.6.0/lib/site_perl/5.6.0/sun4-solaris
    /home/anubis/oberpwd/perl-5.6.0/lib/site_perl/5.6.0
    /home/anubis/oberpwd/perl-5.6.0/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/anubis/oberpwd
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib:/usr/ucblib:/usr/openwin/lib:/usr/X11R6/lib:/opt/gnu/lib:/usr/dt/lib
    LOGDIR (unset)
    PATH=/opt/drts/bin:/home/anubis/oberpwd/gnu/bin:/home/anubis/oberpwd/perl/bin:./:/opt/drts/bin:/home/anubis/oberpwd/gnu/bin:/home/anubis/oberpwd/perl/bin:./:/opt/drts/bin:/home/anubis/oberpwd/gnu/bin:/home/anubis/oberpwd/perl/bin:./:/usr/sbin:/usr/ccs/bin:/usr/proc/bin:/usr/bin:/usr/ucb:/usr/dt/bin:/usr/openwin/bin:/usr/X11R6/bin:/bin:/opt/bin:/opt/gnu/bin:/home/anubis/oberpwd/bin:/opt/ahead/bin:/home/anubis11/FRAME_5.5.6_Sol/bin:/home/anubis18/webworks/quadralay/bin
    PERL_BADLANG (unset)
    SHELL=/bin/csh



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About