RE: Possible race condition with HTTP.c

"Michael Mulcahy" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi Stipe,

I have attached a simple perl script that reproduces the problem (for
me anyway:). It listens on port 8080 and disconnects the listener socket
when a connection attempt is made.

My test case consists of fakesmsc - bearerbox - smsbox - perl script
with smsbox sending http requests to the machine that this script is
running on at port 8080. Fakesmsc sends in 10 MO requests and while
the smsbox is invoking the script it crashes.

When I make the suggested change it works fine.

Thanks,
Michael.

ANAM Wireless Internet Solutions
http://www.anam.com mailto:[email protected]
+353 1 284 7555
Castle Yard, Saint Patrick's Road, Dalkey, County Dublin, Ireland

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> Stipe Tolj
> Sent: 29 March 2003 13:33
> To: [email protected]
> Cc: Kannel Devel (E-mail 2)
> Subject: Re: Possible race condition with HTTP.c
>
>
> Hi Michael,
>
> can this be reproduced with setting up an apache that has a max client
> limit set also?
>
> Stipe
>
> [email protected]
> -------------------------------------------------------------------
> Wapme Systems AG
>
> Vogelsanger Weg 80
> 40470 Düsseldorf
>
> Tel: +49-211-74845-0
> Fax: +49-211-74845-299
>
> E-Mail: [email protected]
> Internet: http://www.wapme-systems.de
> -------------------------------------------------------------------
> wapme.net - wherever you are
test_error.pl (application/x-perl, 919 B)
#!c:\perl\bin\perl -w

use IO::Socket;
use IO::Select;
use Symbol;
use POSIX;


# --------------------------------------------------------------------
# establish SERVER socket, bind and listen.

print "Starting main event loop\n\n";

while(1) {

	my $server = IO::Socket::INET->new(LocalPort => 8080,
                                Type      => SOCK_STREAM,
                                Proto     => 'tcp',
                                Reuse     => 1,
                                Listen    => 10 )
  		or die "Error creating socket: $@\n";

	my $select = IO::Select->new();
	$select->add($server);

	# Wait to accept new connections

    while(($ready) = IO::Select->select($select,undef,undef)) {
        foreach $sock (@$ready) {
            if($sock == $server) {
				print "Incoming connection attempt\n\n";
                # Close socket
                $server->close;
            }
        }
   }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.