<i>Can't flush one line through a socket when using zlib compression/decompression</i>.
by
.
D 2017-09-29T20:17:17.800
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment When\sthe\sserver\sand\sclient\sare\srun\sthrough\stwo\sdifferent\sprocesses,\sI\scannot\sflush\sone\sline\sof\sdata\sthrough\sa\ssocket\swith\szlib\scompression.\r\n\r\nFor\sexample,\swhen\swe\shave:<br>\r\n<b>server.tcl</b><br>\r\n<code>proc\sserver\s{sock\sip\sport}\s{<br>\r\nfconfigure\s$sock\s-buffering\snone\s-blocking\s1<br>\r\nzlib\spush\sdeflate\s$sock<br>\r\nputs\s$sock\s"qwertyuiop"<br>\r\nchan\sconfigure\s$sock\s-flush\ssync<br>\r\nflush\s$sock<br>\r\nputs\s"done!"<br>\r\n}\r\n\r\nsocket\s-server\sserver\s1501\r\n\r\nvwait\sdie</code>\r\n\r\n<b>and\sclient.tcl</b><br>\r\n<code>set\ssock\s[socket\s"127.0.0.1"\s1501]<br>\r\nfconfigure\s$sock\s-buffering\snone\s-blocking\s1<br>\r\nzlib\spush\sinflate\s$sock<br>\r\nputs\s"reading.."<br>\r\nputs\s[gets\s$sock]<br>\r\nclose\s$sock</code>\r\n\r\nIf\syou\sstart\sserver.tcl\sand\sthen\sstart\sclient.tcl,\syou\swill\sfind\sthat\s"qwertyuiop"\sfrom\sserver.tcl\snever\sgets\sflushed.\sClient.tcl\swill\ssimply\swait\sto\sread\sin\sa\sline\sfrom\sthe\ssocket\seven\sthough\swe\ssee\sthat\sserver.tcl\shas\sindicated,\s"done!"\r\n\r\nIf\syou\sremove\sthe\scompression,\swe\sdo\snot\ssee\sthis\sissue.\sHere\sare\sthe\ssame\sserver.tcl\sand\sclient.tcl\sfiles\swith\sno\scompression.\r\n\r\n<b>server.tcl</b><br>\r\n<code>proc\sserver\s{sock\sip\sport}\s{<br>\r\nfconfigure\s$sock\s-buffering\snone\s-blocking\s1<br>\r\nputs\s$sock\s"qwertyuiop"<br>\r\nflush\s$sock<br>\r\nputs\s"done!"<br>\r\n}\r\n\r\nsocket\s-server\sserver\s1501\r\n\r\nvwait\sdie</code>\r\n\r\n<b>and\sclient.tcl</b><br>\r\n<code>set\ssock\s[socket\s"127.0.0.1"\s1501]<br>\r\nfconfigure\s$sock\s-buffering\snone\s-blocking\s1<br>\r\nputs\s"reading.."<br>\r\nputs\s[gets\s$sock]<br>\r\nclose\s$sock</code>\r\n\r\nIf\syou\sstart\sthis\snew\sserver.tcl\sand\sthen\sthe\snew\sstart\sclient.tcl,\syou\swill\ssee\sthat\sthe\sclient.tcl\sprints\s"qwertyuiop"\scorrectly,\sindicating\sthat\sit\swas\sflushed\scorrectly.\sThis\sis\show\sI\sknow\sthat\sthis\sissue\sis\sspecific\sto\szlib\scompression.\r\n\r\nDuring\smy\sindividual\stesting,\sI\sfound\sthat\sI\scould\sforce\sthe\sflush\sto\shappen\scorrectly\sby\sincreasing\sthe\snumber\sof\s"puts"\soperations\sin\sserver.tcl.\sIf\sI\sran\s"puts\s$sock\s"qwertyuiop"\s1000\stimes\sin\sserver.tcl,\sI\scould\sread\s"qwertyuiop"\scorrectly\sin\sclient.tcl.\r\n\r\nThe\sbug\shere\sis\sthat\sflush\sdoes\snot\sappear\sto\sbe\sworking\scorrectly\sfor\sone\sline\swith\szlib\scompression\son\sa\ssocket.
J foundin 8.6.6
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact 8077d0425af928b423525be2baa2a339c588525d
J resolution None
J severity Important
J status Open
J submitter anonymous
J subsystem 57.\szlib
J title Can't\sflush\sone\sline\sthrough\sa\ssocket\swhen\susing\szlib\scompression/decompression
J type Bug
K ca6a9e5659e3a521b77bc239e1028446e9bb2e08
U anonymous
Z 8681ee0ed3b26c70a6f84f501ddbd532