<i>tcltls spins forever calling sendto() on flush of a closed connecton</i>.
by
.
D 2017-09-20T12:47:49.060
J foundin 1.7.12
J icomment FreeBSD\s11,\stcl\s8.6.7,\stcltls\s1.7.12,\sopenssl\s1.0.2k.\r\n\r\nWe\shave\sa\sprocess\sthat\shandles\sa\sTLS\ssocket\sand\son\sEOF\sor\serror,\sit\sexits.\r\n\r\nOn\sexit,\stcl\stries\sto\sflush\sthe\ssocket.\sSometimes,\sthis\swill\send\sup\shanging\sforever\sconsuming\s100%\sCPU.\struss\ssays:\r\n\r\nsendto(10,"\\^W\\^C\\^A\\0\\240\\^V\\^E\\M-Y\\^[\\^N"...,165,0,NULL,0)\sERR#32\s'Broken\spipe'\r\nsendto(10,"\\^W\\^C\\^A\\0\\240\\^V\\^E\\M-Y\\^[\\^N"...,165,0,NULL,0)\sERR#32\s'Broken\spipe'\r\nsendto(10,"\\^W\\^C\\^A\\0\\240\\^V\\^E\\M-Y\\^[\\^N"...,165,0,NULL,0)\sERR#32\s'Broken\spipe'\r\nsendto(10,"\\^W\\^C\\^A\\0\\240\\^V\\^E\\M-Y\\^[\\^N"...,165,0,NULL,0)\sERR#32\s'Broken\spipe'\r\n\r\nforever;\sFD\s10\sis\sthe\sunderlying\sTCP\ssocket.\r\n\r\ngdb\ssays\sit\sis\shanging\shere:\r\n\r\n(gdb)\sbt\r\n#0\s\s0x00000008011d4dfa\sin\s_sendto\s()\sfrom\s/lib/libc.so.7\r\n#1\s\s0x0000000800e76a6f\sin\spthread_suspend_all_np\s()\sfrom\s/lib/libthr.so.3\r\n#2\s\s0x0000000800bf2f71\sin\sTcpOutputProc\s(instanceData=0x8024fd810,\sbuf=0x802452483\s"\\027\\003\\001",\stoWrite=165,\serrorCodePtr=0x7fffffffdb7c)\sat\stclUnixSock.c:560\r\n#3\s\s0x0000000800b63b63\sin\sChanWrite\s(chanPtr=0x80c094890,\ssrc=0x802452483\s"\\027\\003\\001",\ssrcLen=165,\serrnoPtr=0x7fffffffdb7c)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:517\r\n#4\s\s0x0000000800b63af7\sin\sTcl_WriteRaw\s(chan=0x80c094890,\ssrc=0x802452483\s"\\027\\003\\001",\ssrcLen=165)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:4039\r\n#5\s\s0x0000000802cb56ff\sin\sBIO_new_tcl\s()\sfrom\s/usr/local/lib/tls1.7.12/tcltls.so\r\n#6\s\s0x00000008033b56f8\sin\sBIO_write\s()\sfrom\s/lib/libcrypto.so.8\r\n#7\s\s0x0000000802ef6c61\sin\sssl3_write_pending\s()\sfrom\s/usr/lib/libssl.so.8\r\n#8\s\s0x0000000802ef6652\sin\sssl3_write_bytes\s()\sfrom\s/usr/lib/libssl.so.8\r\n#9\s\s0x0000000802edbcf0\sin\sBIO_ssl_shutdown\s()\sfrom\s/usr/lib/libssl.so.8\r\n#10\s0x00000008033b56f8\sin\sBIO_write\s()\sfrom\s/lib/libcrypto.so.8\r\n#11\s0x0000000802cb5e1b\sin\sTls_ChannelType\s()\sfrom\s/usr/local/lib/tls1.7.12/tcltls.so\r\n#12\s0x0000000800b63b63\sin\sChanWrite\s(chanPtr=0x80c097f90,\s\r\n\s\s\s\ssrc=0x80c38f9f8\s"alt\\t3943\\tclock\\t1505832747\\tewvel\\t153.8\\tfpm\\t157\\thexid\\tA0EC3D\\tlat\\t39.9306\\tlon\\t-86.1884\\tnsvel\\t198.0\\torigin\\t1172\\ttype\\tmlat_result\\n",\ssrcLen=125,\s\r\n\s\s\s\serrnoPtr=0x7fffffffde38)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:517\r\n#13\s0x0000000800b62c67\sin\sFlushChannel\s(interp=0x0,\schanPtr=0x80c097f90,\scalledFromAsyncFlush=0)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:2747\r\n#14\s0x0000000800b5f7b4\sin\sTcl_Close\s(interp=0x0,\schan=0x80c097f90)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:3464\r\n#15\s0x0000000800b5e646\sin\sTclFinalizeIOSubsystem\s()\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:657\r\n#16\s0x0000000800b2dd7b\sin\sFinalizeThread\s(quick=1)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclEvent.c:1305\r\n#17\s0x0000000800b2dae2\sin\sTcl_Exit\s(status=5)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclEvent.c:987\r\n#18\s0x0000000800a62b9d\sin\sTcl_ExitObjCmd\s(dummy=0x0,\sinterp=0x801c37950,\sobjc=2,\sobjv=0x801c4a868)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclCmdAH.c:1114\r\n#19\s0x0000000800a536aa\sin\sDispatch\s(data=0x80c319758,\sinterp=0x801c37950,\sresult=0)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclBasic.c:4358\r\n#20\s0x0000000800a4e7f6\sin\sTclNRRunCallbacks\s(interp=0x801c37950,\sresult=0,\srootPtr=0x80c01a540)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclBasic.c:4391\r\n#21\s0x0000000800a50db0\sin\sTclEvalObjEx\s(interp=0x801c37950,\sobjPtr=0x80c08a0b0,\sflags=131072,\sinvoker=0x0,\sword=0)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclBasic.c:5957\r\n#22\s0x0000000800a4df1a\sin\sTcl_EvalObjEx\s(interp=0x801c37950,\sobjPtr=0x80c08a0b0,\sflags=131072)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclBasic.c:5938\r\n#23\s0x0000000800b68f40\sin\sTclChannelEventScriptInvoker\s(clientData=0x80c219cd0,\smask=2)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:8866\r\n#24\s0x0000000800b68af9\sin\sTcl_NotifyChannel\s(channel=0x80c097f90,\smask=2)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclIO.c:8360\r\n#25\s0x0000000800bf2e47\sin\sWrapNotify\s(clientData=0x8024fd810,\smask=2)\sat\stclUnixSock.c:982\r\n#26\s0x0000000800bf7730\sin\sFileHandlerEventProc\s(evPtr=0x80c2e4a50,\sflags=-3)\sat\stclUnixNotfy.c:809\r\n#27\s0x0000000800b92d6c\sin\sTcl_ServiceEvent\s(flags=-3)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclNotify.c:670\r\n#28\s0x0000000800b9326f\sin\sTcl_DoOneEvent\s(flags=-3)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclNotify.c:967\r\n#29\s0x0000000800b2df6b\sin\sTcl_VwaitObjCmd\s(clientData=0x0,\sinterp=0x801c37950,\sobjc=2,\sobjv=0x801c4a6b8)\sat\s/usr/ports/lang/tcl86/work/tcl8.6.7/generic/tclEvent.c:1413\r\n\r\nSome\sdigging\swith\sgdb\sseems\sto\sindicate\sthat\sit\sis\sspinning\sforever\sin\sFlushChannel().\sTlsOutputProc\s("Tls_ChannelType"\sin\sthe\sstacktrace\sabove,\r\nbecause\sstatic\sfunction)\scalls\sBIO_write()\swhich\seventually\sgenerates\sthe\ssendto().\sBIO_write()\sreturns\swith\sSSL_ERROR_ZERO_RETURN.\sTlsOutputProc()\r\nreturns\s0.\sFlushChannel()\sthinks\sthere\sis\smore\swork\sto\sdo\sand\sloops.
J login anonymous
J mimetype text/plain
J private_contact 900fc5ce35b9c7638101bd1f61914637995d3ab3
J severity Severe
J status Open
J title tcltls\sspins\sforever\scalling\ssendto()\son\sflush\sof\sa\sclosed\sconnecton
J type Code\sDefect
K 6dd5588df68a5afdb421d44cb73b94326efffd3a
U anonymous
Z 84f0bc80210890e527c481f669f0cfe5