pthreads

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

pthreads

Tom Callaway
Hi Lua folks,

Recently, a bug came in for Fedora 26 saying that cgit was throwing
error messages, specifically:

/var/www/cgi-bin/cgit: Relink `/lib64/liblua-5.3.so' with
`/lib64/libpthread.so.0' for IFUNC symbol `system'

Now, it's worth pointing out that cgit wasn't actually failing at all,
it was just being noisy in the logs. That said, it seemed like an easy
fix, but in my experience, those are often the most controversial. :)

I've attached a patch which changes configure.ac to check for pthread
support, using the ax_pthread.m4 from autoconf-archive. With this patch
applied to lua-5.3.4, pthreads are detected, cflags and ldflags are set
correctly, and cgit stops throwing this noise.

If there is a more preferred way to handle use of pthreads here, please
let me know, as I do not want Fedora to diverge from lua upstream.

Thanks,

~tom

lua-5.3.4-pthread.patch (30K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

Sebastian Cato
Hello,

This should probably be addressed by the maintainer of the .spec file
for the Lua package on Fedora, and not by Lua itself. system(3) is
after all a standard C library function, and application packages that
depends on the C library shouldn't care what various distributions do
on their platforms.

There is a BUG for it, though no meaningful activity yet:
https://bugzilla.redhat.com/show_bug.cgi?id=1473680

//Sebastian

On Thu, Aug 3, 2017 at 5:48 PM, Tom Callaway <[hidden email]> wrote:

> Hi Lua folks,
>
> Recently, a bug came in for Fedora 26 saying that cgit was throwing
> error messages, specifically:
>
> /var/www/cgi-bin/cgit: Relink `/lib64/liblua-5.3.so' with
> `/lib64/libpthread.so.0' for IFUNC symbol `system'
>
> Now, it's worth pointing out that cgit wasn't actually failing at all,
> it was just being noisy in the logs. That said, it seemed like an easy
> fix, but in my experience, those are often the most controversial. :)
>
> I've attached a patch which changes configure.ac to check for pthread
> support, using the ax_pthread.m4 from autoconf-archive. With this patch
> applied to lua-5.3.4, pthreads are detected, cflags and ldflags are set
> correctly, and cgit stops throwing this noise.
>
> If there is a more preferred way to handle use of pthreads here, please
> let me know, as I do not want Fedora to diverge from lua upstream.
>
> Thanks,
>
> ~tom

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

Sebastian Cato
Sorry, I didn't realize you are a package administrator for said package.

If you don't mind me asking, why don't you just add -lpthread to the
LDFLAGS in lua.spec?

On Thu, Aug 3, 2017 at 6:34 PM, Sebastian Cato <[hidden email]> wrote:

> Hello,
>
> This should probably be addressed by the maintainer of the .spec file
> for the Lua package on Fedora, and not by Lua itself. system(3) is
> after all a standard C library function, and application packages that
> depends on the C library shouldn't care what various distributions do
> on their platforms.
>
> There is a BUG for it, though no meaningful activity yet:
> https://bugzilla.redhat.com/show_bug.cgi?id=1473680
>
> //Sebastian
>
> On Thu, Aug 3, 2017 at 5:48 PM, Tom Callaway <[hidden email]> wrote:
>> Hi Lua folks,
>>
>> Recently, a bug came in for Fedora 26 saying that cgit was throwing
>> error messages, specifically:
>>
>> /var/www/cgi-bin/cgit: Relink `/lib64/liblua-5.3.so' with
>> `/lib64/libpthread.so.0' for IFUNC symbol `system'
>>
>> Now, it's worth pointing out that cgit wasn't actually failing at all,
>> it was just being noisy in the logs. That said, it seemed like an easy
>> fix, but in my experience, those are often the most controversial. :)
>>
>> I've attached a patch which changes configure.ac to check for pthread
>> support, using the ax_pthread.m4 from autoconf-archive. With this patch
>> applied to lua-5.3.4, pthreads are detected, cflags and ldflags are set
>> correctly, and cgit stops throwing this noise.
>>
>> If there is a more preferred way to handle use of pthreads here, please
>> let me know, as I do not want Fedora to diverge from lua upstream.
>>
>> Thanks,
>>
>> ~tom

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

Tom Callaway
On 08/03/2017 12:41 PM, Sebastian Cato wrote:
> Sorry, I didn't realize you are a package administrator for said package.
>
> If you don't mind me asking, why don't you just add -lpthread to the
> LDFLAGS in lua.spec?

I could. But if I'm seeing this issue, then chances are, other people will too.
Seemed like detecting for pthreads availability and applying the change
to LDFLAGS via configure was the best way to avoid someone else posting
this query on this mailing list. :)

Just trying to be a good partner to upstream, rather than have Fedora packages
be the only distro with the solution here.

But, if the upstream preference is to just have Fedora override LDFLAGS
in our lua package build, easy enough.

~tom

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

Luiz Henrique de Figueiredo
> Just trying to be a good partner to upstream, rather than have Fedora packages
> be the only distro with the solution here.
>
> But, if the upstream preference is to just have Fedora override LDFLAGS
> in our lua package build, easy enough.

I'm probably missing something here, but if upstream is the source package
at lua.org, then it does not use pthreads nor aims to build Lua as an .so.

Thank you for proving Fedora packages for Lua.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

William Ahern
In reply to this post by Tom Callaway
On Thu, Aug 03, 2017 at 11:48:06AM -0400, Tom Callaway wrote:

> Hi Lua folks,
>
> Recently, a bug came in for Fedora 26 saying that cgit was throwing
> error messages, specifically:
>
> /var/www/cgi-bin/cgit: Relink `/lib64/liblua-5.3.so' with
> `/lib64/libpthread.so.0' for IFUNC symbol `system'
>
> Now, it's worth pointing out that cgit wasn't actually failing at all,
> it was just being noisy in the logs. That said, it seemed like an easy
> fix, but in my experience, those are often the most controversial. :)
>
> I've attached a patch which changes configure.ac to check for pthread
> support, using the ax_pthread.m4 from autoconf-archive. With this patch
> applied to lua-5.3.4, pthreads are detected, cflags and ldflags are set
> correctly, and cgit stops throwing this noise.
>
> If there is a more preferred way to handle use of pthreads here, please
> let me know, as I do not want Fedora to diverge from lua upstream.

I found it really odd that -lpthread would need to be linked in for Lua's
use of system. It seems this might be a glibc regression introduced in 2.25.
See

  http://lists.openembedded.org/pipermail/openembedded-core/2017-January/130983.html
  http://lists.openembedded.org/pipermail/openembedded-core/2017-January/131119.html

Does cgit link against -lpthread, directly or indirectly (via another
library)? I wonder if this could be fixed by simply reordering the link
order, making sure -llua is specified before -lcurl, -lssl or w'ever
is bringing in pthreads.

I don't have a Fedora system to test on at the moment. But if you begin
building liblua-5.3.so with -lpthread, there's probably no going back unless
you want to risk breaking other people who accidentally end up relying on
liblua linking in pthreads--because they forget to link in pthreads, or
maybe because some library autodetects pthreads at runtime and changes
behavior, or because -lpthread overrides and re-implements severl libc
functions (e.g. longjmp and system), and these different implementations
might have different behavior.

OTOH, the _interpreter_ probably should link with -lpthreads. glibc has too
many bugs when lazily loading and initializing pthreads via dlopen. Both the
Perl and Python interpreters link in pthreads.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pthreads

Tom Callaway
On 08/04/2017 12:49 AM, William Ahern wrote:

> I found it really odd that -lpthread would need to be linked in for Lua's
> use of system. It seems this might be a glibc regression introduced in 2.25.
> See
>
>   http://lists.openembedded.org/pipermail/openembedded-core/2017-January/130983.html
>   http://lists.openembedded.org/pipermail/openembedded-core/2017-January/131119.html

This was very helpful, thanks. I confirmed with our glibc maintainer
that this is the same bug, and he agreed that we should not link the lua
lib against pthreads.

Please discard my patch. :)

Thanks,

~tom

Loading...