hiredis icon indicating copy to clipboard operation
hiredis copied to clipboard

setsockopt call issue on SPARC Solaris 10 Test#46 Failing

Open jvdvjvdv opened this issue 7 years ago • 1 comments

Think it is related: SO_RCVTIMEO might not be supported on Solaris 10? http://unix.stackexchange.com/questions/62859/default-value-for-so-rcvtimeo-option-on-solaris

[root@TweedleDee]/export/home/jvdv/hiredis/hiredis> uname -a SunOS TweedleDee 5.10 Generic_142909-17 sun4u sparc SUNW,Sun-Fire-V245

[root@TweedleDee]/export/home/jvdv/hiredis/hiredis> gcc -v Reading specs from /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.9.2/specs COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/sparc-sun-solaris2.10/4.9.2/lto-wrapper Target: sparc-sun-solaris2.10 Configured with: /home/dam/mgar/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.9.2/configure --prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --sharedstatedir=/opt/csw/share --localstatedir=/var/opt/csw --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --includedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-cloog-backend=isl --enable-java-awt=xlib --enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --enable-nls --enable-objc-gc --enable-threads=posix --program-suffix=-4.9 --with-cloog=/opt/csw --with-gmp=/opt/csw --with-included-gettext --with-ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw --with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw --with-as=/usr/ccs/bin/as --without-gnu-as Thread model: posix gcc version 4.9.2 (GCC)

Compiled with: gmake CC=/opt/csw/bin/gcc

===================================================================== hiredis-test === [root@TweedleDee]/export/home/jvdv/hiredis/hiredis> vall -o truss.out ./hiredis-test < #01 Format command without interpolation: PASSED #02 Format command with %s string interpolation: PASSED #03 Format command with %s and an empty string: PASSED #04 Format command with an empty string in between proper interpolations: PASSED #05 Format command with %b string interpolation: PASSED #06 Format command with %b and an empty string: PASSED #07 Format command with literal %: PASSED #08 Format command with printf-delegation (int): PASSED #09 Format command with printf-delegation (char): PASSED #10 Format command with printf-delegation (short): PASSED #11 Format command with printf-delegation (long): PASSED #12 Format command with printf-delegation (long long): PASSED #13 Format command with printf-delegation (unsigned int): PASSED #14 Format command with printf-delegation (unsigned char): PASSED #15 Format command with printf-delegation (unsigned short): PASSED #16 Format command with printf-delegation (unsigned long): PASSED #17 Format command with printf-delegation (unsigned long long): PASSED #18 Format command with printf-delegation (float): PASSED #19 Format command with printf-delegation (double): PASSED #20 Format command with invalid printf format: PASSED #21 Format command by passing argc/argv without lengths: PASSED #22 Format command by passing argc/argv with lengths: PASSED #23 Format command into sds by passing argc/argv without lengths: PASSED #24 Format command into sds by passing argc/argv with lengths: PASSED #25 Error handling in reply parser: PASSED #26 Memory cleanup in reply parser: PASSED #27 Set error on nested multi bulks with depth > 7: PASSED #28 Works with NULL functions for reply: PASSED #29 Works when a single newline (\r\n) covers two calls to feed: PASSED #30 Don't reset state after protocol error: PASSED #31 Don't do empty allocation for empty multi bulk: PASSED #32 Returns error when host cannot be resolved: FAILED #33 Returns error when the port is not open: PASSED #34 Returns error when the unix_sock socket path doesn't accept connections: PASSED #35 Don't fail when redisFree is passed a NULL value: PASSED #36 Don't fail when freeReplyObject is passed a NULL value: PASSED

Testing against TCP connection (127.0.0.1:6379): #37 Is able to deliver commands: PASSED #38 Is a able to send commands verbatim: PASSED #39 %s String interpolation works: PASSED #40 %b String interpolation works: PASSED #41 Binary reply length is correct: PASSED #42 Can parse nil replies: PASSED #43 Can parse integer replies: PASSED #44 Can parse multi bulk replies: PASSED #45 Can handle nested multi bulk replies: PASSED #46 Successfully completes a command when the timeout is not exceeded: ProbePoint1trueFAILED <---Fail in Probepoint1

Assertion failed: reply != NULL, file test.c, line 81, function disconnect

===================================================================== Truss dump === 28254/1: 0.0714 fcntl(4, F_SETFL, FWRITE) = 0 28254/1: 0.0715 setsockopt(4, tcp, TCP_NODELAY, 0xFFBFF9E4, 4, SOV_DEFAULT) = 0 28254/1: 0.0717 write(4, 0x0003367B, 23) = 23 28254/1: * 2\r\n $ 6\r\n S E L E C T\r\n $ 1\r\n 9\r\n 28254/1: 0.0721 read(4, " + O K\r\n", 16384) = 5 28254/1: 0.0723 write(4, 0x0003367B, 16) = 16 28254/1: * 1\r\n $ 6\r\n D B S I Z E\r\n 28254/1: 0.0724 read(4, " : 0\r\n", 16384) = 4 28254/1: 0.0725 write(4, 0x000336AB, 32) = 32 28254/1: * 3\r\n $ 3\r\n S E T\r\n $ 3\r\n f o o\r\n $ 4\r\n f a s t\r\n 28254/1: 0.0727 read(4, " + O K\r\n", 16384) = 5 28254/1: 0.0728 setsockopt(4, SOL_SOCKET, SO_RCVTIMEO, 0xFFBFFB48, 8, SOV_DEFAULT) Err#99 ENOPROTOOPT<---This is it! 28254/1: 0.0729 write(1, 0xFF23A0D8, 106) = 106 28254/1: # 4 6 S u c c e s s f u l l y c o m p l e t e s a c o m 28254/1: m a n d w h e n t h e t i m e o u t i s n o t e x c 28254/1: e e d e d : P r o b e P o i n t 1 t r u e1B [ 0 ; 3 1 m F A I 28254/1: L E D1B [ 0 ; 0 m\n 28254/1: 0.0732 write(2, 0xFFBFF8F0, 75) = 75 28254/1: A s s e r t i o n f a i l e d : r e p l y ! = N U L L , 28254/1: f i l e t e s t . c , l i n e 8 1 , f u n c t i o n 28254/1: d i s c o n n e c t\n 28254/1: 0.0733 sigaction(SIGABRT, 0x00000000, 0xFFBFF870) = 0 28254/1: old: hand = 0x00000000 mask = 0 0 0 0 flags = 0x0000 28254/1: 0.0735 sigaction(SIGABRT, 0xFFBFF720, 0xFFBFF7C0) = 0 28254/1: new: hand = 0x00000000 mask = 0 0 0 0 flags = 0x0012 28254/1: old: hand = 0x00000000 mask = 0 0 0 0 flags = 0x0000 28254/1: 0.0736 lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000) = 0xFFBFFEFF [0x0000FFFF] 28254/1: 0.0737 lwp_kill(1, SIGABRT) = 0 28254/1: 0.0737 Received signal #6, SIGABRT [default] 28254/1: siginfo: SIGABRT pid=28254 uid=0 code=-1 (END)

===================================================================== modified net.c === int redisContextSetTimeout(redisContext c, const struct timeval tv) { if (setsockopt(c->fd,SOL_SOCKET,SO_RCVTIMEO,&tv,sizeof(tv)) == -1) { redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_RCVTIMEO)"); printf("ProbePoint1");<---We end up here with (Err#99 ENOPROTOOPT) see truss* return REDIS_ERR; } if (setsockopt(c->fd,SOL_SOCKET,SO_SNDTIMEO,&tv,sizeof(tv)) == -1) { __redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_SNDTIMEO)"); printf("ProbePoint2"); return REDIS_ERR; } printf("ProbePoint3"); return REDIS_OK; }

jvdvjvdv avatar Aug 31 '16 04:08 jvdvjvdv

Yes, Solaris doesn't support setting SO_RCVTIMEO and SO_SNDTIMEO on socket using setsockopt(). One solution is to use non-blocking socket and poll(). @badboy would you be interested in having this patch?

Can we add labels 'Solaris' and 'Bug' pls?

amallia avatar Jun 15 '17 20:06 amallia