[vlc-devel] vlc bug/patch (Linux libvlccore): might hang in vlc_getProxyUrl() / waitpid()
Filip Roséen
filip at atch.se
Wed Dec 14 19:30:57 CET 2016
Hi Andreas Luik,
It is far more appropriate using our tracker to report bugs, could you
please migrate the information posted here on the *mailing-list* to
the below:
- https://trac.videolan.org/vlc
On 2016-12-13 10:53, Andreas Luik wrote:
> Hello,
>
> bug report for vlc-2.1.6 (also in latest 2.2.4): we use libvlccore
> in one thread of our multi-threaded application, and observe the
> function vlc_getProxyUrl() to (often) hang forever in this loop:
>
> while (waitpid(pid, &(int){ 0 }, 0) == -1);
>
> The reason for this is that another thread might have already
> handled the wait(), and the process "pid" does not exist anymore,
> resulting in waitpid(pid) returning -1 (with errno==ECHILD) forever.
>
> It definitely does not make sense to repeat calling waitpid for a
> pid which does not exist anymore. Proposed patch is attached.
>
> BTW: the second parameter of waitpid() might be simplified to (int
> *)NULL.
>
> Kind regards,
> --
> i. A. Andreas Luik
> Senior System Integrator
> in-innovative navigation GmbH
> phone: +49 7154 807171
> fax: +49 7154 807154
> email: Andreas.Luik at innovative-navigation.de
>
> in-innovative navigation GmbH, Leibnizstrasse 11, D-70806 Kornwestheim
> Geschäftsführer/Managing Directors:
> Dr. Thomas Gern, Dr. Martin Sandler, Dr. Reinhard Zimmermann, Uwe Vögele
> Handelsregister: Stuttgart HRB 205770
>
> in-innovative navigation GmbH is ISO 9001:2008 certified.
>
> *** ./src/posix/netconf.c.orig 2015-02-02 20:42:32.000000000 +0100
> --- ./src/posix/netconf.c 2016-12-13 10:48:33.175593341 +0100
> ***************
> *** 94,100 ****
> while (len < sizeof (buf));
>
> close(fd[0]);
> ! while (waitpid(pid, &(int){ 0 }, 0) == -1);
>
> if (len >= 9 && !strncasecmp(buf, "direct://", 9))
> return NULL;
> --- 94,100 ----
> while (len < sizeof (buf));
>
> close(fd[0]);
> ! while (waitpid(pid, &(int){ 0 }, 0) == -1 && errno != ECHILD);
>
> if (len >= 9 && !strncasecmp(buf, "direct://", 9))
> return NULL;
The proposed patch *LGTM*, it should however be noted that
you can send such patches directly to the mailing-list (ready for
merge) by utilizing `git format-patch` + `git send-email`.
Best Regards,\
Filip Roséen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161214/c51f28d0/attachment.html>
More information about the vlc-devel
mailing list