[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
TCPProblem -- more info -- short program that hangs included
From: |
Alex Pavloff |
Subject: |
TCPProblem -- more info -- short program that hangs included |
Date: |
Fri, 7 Feb 2003 11:58:33 -0800 |
Here is a sample program that duplicates the problems I described yesterday.
What's going on here? Is it CC++ that's broken or gcc? Would other people
try this and see what the result is? It appears that after 32 or 33 quickly
repeated call to isPending(), something breaks horribly.
#include <cc++/socket.h>
int main()
{
try
{
// Just connect to a port that won't send data -- doesn't
matter what
ost::TCPStream foo("10.0.0.5",5800,512,true,100);
for( ; ; )
{
while( foo.isPending(ost::Socket::pendingInput,100)
);
}
}
catch( ost::Socket* s )
{
std::cout << "Socket error" << std::endl;
}
return 0;
}
Here is the GDB backtrace. Notice how the this pointer got completely
clobbered
resulting in a massively large value being passed to poll(), which causes
the hang
but what causes the clobbering in the first place?
(gdb) bt
#0 0x420d224b in poll () from /lib/i686/libc.so.6
#1 0x4004436f in ost::Socket::isPending(ost::Socket::Pending, unsigned
long) (
this=0xfffffffc, pending=53, timeout=3221222896) at socket.cpp:502
#2 0x400466bc in ost::TCPStream::isPending(ost::Socket::Pending, unsigned
long) (this=0xbffff670, pending=pendingInput, timeout=100) at
socket.cpp:1158
#3 0x0804903e in main () at cute.cpp:12
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
- TCPProblem -- more info -- short program that hangs included,
Alex Pavloff <=