GNOME Bugzilla – Bug 322456
[multiudpsink] gethostbyname might not be thread-safe
Last modified: 2012-06-02 14:59:49 UTC
Bug is hard to reproduce and i'm not sure that this is causing it but I think we should use gethostbyname_r since this is multithreaded... (Helgrind will show a mem race possible condition with getbyhostname) Here's a patch for it...
Created attachment 55233 [details] [review] Path to use gethostbyname_r rather then gethostbyname
It is indeed a good idea to use gethostbyname_r() if it is available, we need to check however whether it is actually available on this system, and we also need to check for different prototypes (GLIBC, Solaris/Irix, HP-UX all have different protypes if I remember correctly) and provide implementations for the different prototypes.
how do we go about this? commit and wait for people to submit patches?
Not sure if we should just commit it like this given that we know it will break on certain other systems. Unfortunately we don't even have a libgstutils where stuff like this could go ...
If the patch is improved to detect gethostbyname_r() in configure.ac and use it if it exists, the patch should be applied.
In the meantime, sometime during 2008, gethostbyname() was removed and replaced by... nothing. I guess nobody sends hostnames to multifdsink.
Replaced by getaddrinfo in 0.10 and g_resolver_lookup_by_name() in master, closing as OBSOLETE.