<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Yes, these patches are working on my case.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The essential idea in these patches is to keep the opened events,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
but the fix is not elegant enough for the static array and the 4095 limit.<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is there a way to rewrite the struct of pollfd including a member</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and keeping the opened events in it only on Windows?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Zhigang.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> vlc-devel <vlc-devel-bounces@videolan.org> 代表 Steve Lhomme <robux4@ycbcr.xyz><br>
<b>发送时间:</b> 2019年1月16日 16:13<br>
<b>收件人:</b> vlc-devel@videolan.org<br>
<b>主题:</b> Re: [vlc-devel] 答复: [PATCH] core: network: recover from reading on invalid sockets</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Do these patches fix your issue ?<br>
<br>
<a href="https://patches.videolan.org/patch/13959/">https://patches.videolan.org/patch/13959/</a><br>
<a href="https://patches.videolan.org/patch/13960/">https://patches.videolan.org/patch/13960/</a><br>
<a href="https://patches.videolan.org/patch/13961/">https://patches.videolan.org/patch/13961/</a><br>
<br>
On 16/01/2019 07:19, Xie Zhigang wrote:<br>
> Hi,<br>
><br>
> Exactly YES, it is related to <a href="https://trac.videolan.org/vlc/ticket/21153">
https://trac.videolan.org/vlc/ticket/21153</a> .<br>
><br>
> WSAEventSelect() does not get the FD_CLOSE event, and the poll() is in dysfunctional state<br>
> if remote server TCP RST the connection. I have dumped the traffic data as resuming the play:<br>
><br>
> #28362  30.011007   TCP 68  38912 → 80 [ACK] Seq=350 Ack=21995213 Win=768 Len=0 TSval=4568331 TSecr=555407<br>
> #28392  30.236684   TCP 836 [TCP Window Full] 80 → 38912 [PSH, ACK] Seq=21995213 Ack=350 Win=30080 Len=768 TSval=555474 TSecr=4568331 [TCP segment of a reassembled PDU]<br>
> #28393  30.236717   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4568387 TSecr=555474<br>
> #28394  30.460288   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=555530 TSecr=4568387<br>
> #28395  30.460300   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4568443 TSecr=555474<br>
> #28396  30.908290   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=555642 TSecr=4568443<br>
> #28397  31.804538   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=555866 TSecr=4568443<br>
> #28398  31.804564   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4568779 TSecr=555474<br>
> #28399  33.600277   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=556315 TSecr=4568779<br>
> #28400  33.600290   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4569228 TSecr=555474<br>
> #28401  37.188314   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=557212 TSecr=4569228<br>
> #28402  37.188347   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4570125 TSecr=555474<br>
> #28435  44.372520   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=559008 TSecr=4570125<br>
> #28436  44.372531   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4571921 TSecr=555474<br>
> #28469  58.744435   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=562601 TSecr=4571921<br>
> #28470  58.744451   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4575514 TSecr=555474<br>
> #28561  87.508600   TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=569792 TSecr=4575514<br>
> #28562  87.508611   TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4582705 TSecr=555474<br>
> #28739  144.980525  TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=584160 TSecr=4582705<br>
> #28740  144.980549  TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4597073 TSecr=555474<br>
> #29080  259.797508  TCP 68  [TCP Keep-Alive]  80 → 38912 [ACK] Seq=21995980 Ack=350 Win=30080 Len=0 TSval=612864 TSecr=4597073<br>
> #29081  259.797533  TCP 68  [TCP ZeroWindow]  38912 → 80 [ACK] Seq=350 Ack=21995981 Win=0 Len=0 TSval=4625777 TSecr=555474<br>
> #34207  2022.822738 TCP 68  [TCP Window Update] 38912 → 80 [ACK] Seq=350 Ack=21995981 Win=75136 Len=0 TSval=5066533 TSecr=555474<br>
> #34208  2022.823030 TCP 62  80 → 38912 [RST] Seq=21995981 Win=0 Len=0<br>
><br>
> As we expect an FD_CLOSE event on the TCP RST traffic, but poll() is in ignorance of it.<br>
> It is reproducible on Windows. On Linux, the poll() is in another implementation and it is ok.<br>
><br>
> I found another patch to it in poll()'s windows implementation,<br>
> that is to reset the errno at the beginning of poll() implementation.<br>
> It seems to enable the capability of WSAEventSelect() for FD_CLOSE,<br>
> but it is more difficult to be considered as a good fix than my first patch is:<br>
><br>
> ---<br>
>   compat/poll.c | 2 ++<br>
>   1 file changed, 2 insertions(+)<br>
><br>
> diff --git a/compat/poll.c b/compat/poll.c<br>
> index 8020f7d..5ff43ea 100644<br>
> --- a/compat/poll.c<br>
> +++ b/compat/poll.c<br>
> @@ -113,6 +113,8 @@ static int poll_compat(struct pollfd *fds, unsigned nfds, int timeout)<br>
>   {<br>
>       DWORD to = (timeout >= 0) ? (DWORD)timeout : INFINITE;<br>
>   <br>
> +    /* clears the errno to enable WSAEventSelect detecting the FD_CLOSE event. */<br>
> +    errno = 0;<br>
>       if (nfds == 0)<br>
>       {    /* WSAWaitForMultipleEvents() does not allow zero events */<br>
>           if (SleepEx(to, TRUE))<br>
> -- <br>
> 2.7.4<br>
><br>
><br>
> 发件人: vlc-devel <vlc-devel-bounces@videolan.org> 代表 jeremy.vignelles@dev3i.fr <jeremy.vignelles@dev3i.fr><br>
> 发送时间: 2019年1月15日 23:37<br>
> 收件人: 'Mailing list for VLC media player developers'<br>
> 主题: Re: [vlc-devel] [PATCH] core: network: recover from reading on invalid sockets<br>
>   <br>
> Hi,<br>
> Is this patch related to <a href="https://trac.videolan.org/vlc/ticket/21153">https://trac.videolan.org/vlc/ticket/21153</a> ?<br>
><br>
> This does not look like a proper fix for me either.<br>
><br>
> Regards,<br>
> Jérémy VIGNELLES<br>
><br>
> De : vlc-devel <vlc-devel-bounces@videolan.org> De la part de Rémi Denis-Courmont<br>
> Envoyé : mardi 15 janvier 2019 15:39<br>
> À : Mailing list for VLC media player developers <vlc-devel@videolan.org><br>
> Objet : Re: [vlc-devel] [PATCH] core: network: recover from reading on invalid sockets<br>
><br>
> Hi,<br>
><br>
> This statistical approach oooks like it can lead to spurious failures, on all platforms. No way.<br>
><br>
> The bug must be somewhere else.<br>
> Le 15 janvier 2019 13:52:12 GMT+02:00, Xie Zhigang <<a href="mailto:zighouse@hotmail.com">mailto:zighouse@hotmail.com</a>> a écrit :<br>
> Fix the bug on Windows: if pausing the on-line VOD playing<br>
> for a long time (5 minutes or so), and the remote VOD server drops the<br>
> tcp connection, vlc_tls_Read() will be in an endless loop of retrial<br>
> with errno as EAGAIN. Use a max retrial count to recover vlc from the<br>
> endless reading loop.<br>
> ________________________________________<br>
>   src/network/stream.c | 7 +++++++<br>
>   1 file changed, 7 insertions(+)<br>
><br>
> diff --git a/src/network/stream.c b/src/network/stream.c<br>
> index 6e015d5..7324f78 100644<br>
> --- a/src/network/stream.c<br>
> +++ b/src/network/stream.c<br>
> @@ -55,6 +55,7 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf, size_t len, bool waitall)<br>
>   {<br>
>       struct pollfd ufd;<br>
>       struct iovec iov;<br>
> +    int turn = 0;<br>
>   <br>
>       ufd.events = POLLIN;<br>
>       ufd.fd = vlc_tls_GetPollFD(session, &ufd.events);<br>
> @@ -89,6 +90,12 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf, size_t len, bool waitall)<br>
>           }<br>
>   <br>
>           vlc_poll_i11e(&ufd, 1, -1);<br>
> +        /*<br>
> +         * Use an arbitrary max retrial count (10) to recover from endless loop<br>
> +         * on an invalid connection.<br>
> +         */<br>
> +        if (++turn > 10)<br>
> +            return rcvd ? (ssize_t)rcvd : -1;<br>
>       }<br>
>   }<br>
>   <br>
><br>
> --<br>
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br>
><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></div>
</span></font></div>
</body>
</html>