[complement-svn] SF.net SVN: complement:[1978] trunk/complement/explore/lib/sockios/ut
Status: Pre-Alpha
Brought to you by:
complement
|
From: <com...@us...> - 2008-10-13 10:40:06
|
Revision: 1978
http://complement.svn.sourceforge.net/complement/?rev=1978&view=rev
Author: complement
Date: 2008-10-13 10:39:50 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
Simplest test for server stalling after client close connection
Server side stack (i.e. child process):
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7f63535 in pthread_join () from /lib/libpthread.so.0
\#2 0xb80c3738 in stlp_std::tr2::thread_base::join (this=0xbfbee488) at thread.cc:394
\#3 0x08085702 in ~connect_processor (this=0xbfbee310) at ../../../include/sockios/socksrv.h:255
\#4 0x08060694 in sockios2_test::disconnect_rawclnt (this=0xbfbee94e, __exam_ts=0xbfbee8cc,
__exam_counter=0) at sockios2_test.cc:638
\#5 0x0808ca6a in exam::detail::method_invoker<sockios2_test>::operator() (this=0x9aae63c,
ts=0xbfbee8cc, count=0) at ../../../include/exam/suite.h:95
\#6 0x0808ca8e in exam::detail::call_impl_t<exam::detail::method_invoker<sockios2_test> >::invoke (
this=0x9aae638, s=0xbfbee8cc, count=0) at ../../../include/exam/suite.h:54
\#7 0xb80837ac in exam::detail::call::operator() (this=0x9aae638, ts=0xbfbee8cc, count=0)
at ../../include/exam/suite.h:119
\#8 0xb8083843 in exam::detail::test_case::operator() (this=0x9aae638, ts=0xbfbee8cc, count=0)
at ../../include/exam/suite.h:138
\#9 0xb8081bde in exam::test_suite::run_test_case (this=0xbfbee8cc, v=16, n=0) at suite.cc:255
\#10 0xb80822c5 in exam::test_suite::single (this=0xbfbee8cc, one=16) at suite.cc:125
\#11 0x0808ab8a in main (argc=1, argv=0xbfbeedb4) at sockios_test_suite.cc:135
(gdb) info threads
3 Thread 0xb7d63b90 (LWP 17358) 0xb80d3424 in __kernel_vsyscall ()
2 Thread 0xb7562b90 (LWP 17359) 0xb80d3424 in __kernel_vsyscall ()
1 Thread 0xb7d648e0 (LWP 17357) 0xb80d3424 in __kernel_vsyscall ()
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7f666c5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
\#2 0x0807d439 in stlp_std::tr2::__condition_variable<false>::wait (this=0x9aaf564, lock=@0xb75621b8)
at ../../../include/mt/condition_variable:104
\#3 0x0807d4d4 in stlp_std::tr2::__condition_variable<false>::wait<stlp_std::basic_sockbuf<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::rdready_t> (this=0x9aaf564, lock=@0xb75621b8, pred=
{b = @0x9aaf4dc}) at ../../../include/mt/condition_variable:116
\#4 0x0807d62d in stlp_std::basic_sockbuf<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::underflow (this=0x9aaf4dc) at ../../../include/sockios/sockstream.cc:325
\#5 0x0806258e in stlp_std::basic_streambuf<char, stlp_std::char_traits<char> >::uflow (this=0x9aaf4dc)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_streambuf.c:165
\#6 0x08061d72 in stlp_std::basic_streambuf<char, stlp_std::char_traits<char> >::sbumpc (
this=0x9aaf4dc) at /export/home/ptr/STLport.lab/STLport/stlport/stl/_streambuf.h:229
\#7 0x0807f4d9 in stlp_std::priv::__read_unbuffered<char, stlp_std::char_traits<char>, stlp_std::priv::_Constant_unary_fun<bool, int> > (__that=0x9aaf4d0, __buf=0x9aaf4dc, _Num=4,
__s=0xb75622b8 "1234$?\222\006\b\020?\228?\190?\191?\204?\227?\190?\191?\248\"V?\183?\215?\218\a\b?\236\"V?\183?\160?\243?\170\t\020?\227?\190?\191", __is_delim={_M_val = false},
__extract_delim=false, __append_null=false, __is_getline=false)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_istream.c:597
\#8 0x0807fa75 in stlp_std::basic_istream<char, stlp_std::char_traits<char> >::read (this=0x9aaf4d0,
__s=0xb75622b8 "1234$?\222\006\b\020?\228?\190?\191?\204?\227?\190?\191?\248\"V?\183?\215?\218\a\b?\236\"V?\183?\160?\243?\170\t\020?\227?\190?\191", __n=4)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_istream.c:796
\#9 0x0807fb36 in srv_reader::connect (this=0x9aaf428, s=@0x9aaf4d0) at sockios2_test.cc:590
\#10 0x080830a9 in stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>::worker (this=0xbfbee310) at ../../../include/sockios/socksrv.cc:296
\#11 0x08083315 in stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>::loop (me=0xbfbee310) at ../../../include/sockios/socksrv.h:285
\#12 0x0806e932 in stlp_std::tr2::basic_thread<0u, 0u>::_call<void (*)(stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>*), stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>*> (
p=0xbfbee488) at ../../../include/mt/thread:477
\#13 0xb7f62120 in start_thread () from /lib/libpthread.so.0
\#14 0xb7eed3fe in clone () from /lib/libc.so.6
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7eedc06 in epoll_wait () from /lib/libc.so.6
\#2 0x08082202 in stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::io_worker (this=0x9aaf1d0) at ../../../include/sockios/sockmgr.cc:33
\#3 0x08082567 in stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::_loop (me=0x9aaf1d0) at ../../../include/sockios/sockmgr.h:147
\#4 0x0806e622 in stlp_std::tr2::basic_thread<0u, 0u>::_call<void (*)(stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >*), stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >*> (p=0x9aaf260) at ../../../include/mt/thread:477
\#5 0xb7f62120 in start_thread () from /lib/libpthread.so.0
\#6 0xb7eed3fe in clone () from /lib/libc.so.6
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
trunk/complement/explore/lib/sockios/ut/sockios2_test.h
trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 01:43:37 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:20:58 ptr>
/*
*
@@ -599,6 +599,90 @@
std::tr2::condition_event srv_reader::cnd;
+int EXAM_IMPL(sockios2_test::disconnect_rawclnt)
+{
+ // throw exam::skip_exception();
+
+ const char fname[] = "/tmp/sockios2_test.shm";
+ xmt::shm_alloc<0> seg;
+
+ try {
+ seg.allocate( fname, 4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 );
+ }
+ catch ( xmt::shm_bad_alloc& err ) {
+ EXAM_ERROR( err.what() );
+ try {
+ seg.allocate( fname, 4096, 0, 0660 );
+ }
+ catch ( xmt::shm_bad_alloc& err2 ) {
+ EXAM_ERROR( err.what() );
+ return EXAM_RESULT;
+ }
+ }
+
+ xmt::allocator_shm<barrier_ip,0> shm;
+ barrier_ip& b = *new ( shm.allocate( 1 ) ) barrier_ip();
+
+ try {
+ this_thread::fork();
+
+ int res = 0;
+
+ {
+ connect_processor<srv_reader> prss( 2008 );
+
+ EXAM_CHECK_ASYNC_F( prss.good(), res );
+
+ b.wait();
+
+ EXAM_CHECK_ASYNC_F( srv_reader::cnd.timed_wait( milliseconds( 800 ) ), res );
+ // srv_reader::cnd.wait();
+ }
+
+ exit( res );
+ }
+ catch ( std::tr2::fork_in_parent& child ) {
+ b.wait();
+
+ char buf[] = "1234";
+
+ int fd = socket( PF_INET, SOCK_STREAM, 0 );
+
+ EXAM_CHECK( fd != 0 );
+
+ union sockaddr_t {
+ sockaddr_in inet;
+ sockaddr any;
+ } address;
+
+ int port = 2008;
+
+ address.inet.sin_family = AF_INET;
+ address.inet.sin_port = ((((port) >> 8) & 0xff) | (((port) & 0xff) << 8));
+ address.inet.sin_addr = std::findhost( "localhost" );
+
+ EXAM_CHECK( connect( fd, &address.any, sizeof( address ) ) != -1 );
+
+ EXAM_CHECK( ::write( fd, buf, 4 ) == 4 );
+
+ ::close( fd );
+
+ int stat = -1;
+ EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
+ if ( WIFEXITED(stat) ) {
+ EXAM_CHECK( WEXITSTATUS(stat) == 0 );
+ } else {
+ EXAM_ERROR( "child fail" );
+ }
+ }
+
+ shm.deallocate( &b );
+ seg.deallocate();
+ unlink( fname );
+
+ return EXAM_RESULT;
+}
+
int EXAM_IMPL(sockios2_test::disconnect)
{
throw exam::skip_exception();
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.h
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 00:36:27 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:05:17 ptr>
/*
*
@@ -23,6 +23,7 @@
int EXAM_DECL(srv_core);
int EXAM_DECL(connect_disconnect);
int EXAM_DECL(disconnect);
+ int EXAM_DECL(disconnect_rawclnt);
int EXAM_DECL(processor_core_one_local);
int EXAM_DECL(processor_core_two_local);
int EXAM_DECL(processor_core_getline);
Modified: trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 00:39:27 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:22:23 ptr>
/*
*
@@ -88,6 +88,7 @@
t.add( &sockios2_test::srv_core, test2, "sockios2_test::srv_core" ) ) ) ) ) ) ) ) );
t.add( &sockios2_test::disconnect, test2, "sockios2_test::disconnect", tc[3] );
+ t.add( &sockios2_test::disconnect_rawclnt, test2, "disconnect raw client", tc[3] );
t.add( &sockios2_test::income_data, test2, "all data available after sockstream was closed, different processes", tc[4] );
Opts opts;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|