New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to link perl with system threads library by default #14133
Comments
From verdrehung@gmail.comCreated by oleg@cpan.orgFor now we have two perl types: threaded and non-threaded. Of course someone can use '-A prepend:libswanted="pthread "' So, my proposal is to always link perl with system threads library Perl Info
|
From @craigberryOn Sat, Oct 4, 2014 at 8:49 AM, �лег � <perlbug-followup@perl.org> wrote:
If you can propose how to guarantee that all Perl ops are executed in |
The RT System itself - Status changed from 'new' to 'open' |
From @bulk88Unthreaded perl doesn't need to know about OS threads. If your app is crashing because an unthreaded perl is running in 2 different OS threads simultaneously, well, then you need to fix the XS code that passed a function pointer that contains a call_sv() to some non-Perl C function which started a thread, or ran the function pointer in a thread pool thread. It is completely safe to run a perl interp on different OS threads provided that all perl C calls (and eventually Perl language calls in the runloop) are serialized. They have to be serialized using OS specific APIs (mutex, critical section, semaphore, whatever). Read http://perlmonks.org/?node_id=973277 and http://perlmonks.org/?node=870516 -- |
From @TuxOn Sat, 4 Oct 2014 06:49:35 -0700, _______ _ (via RT)
Most of them are not. Some are. e.g. on HP-UX all perls are linked with -lpthread, as that is required
s/use/require/ If an .so is linked with -lpthread, it needs it for loading, even if
s/crash/not load/
yes, that is mentioned in several places in the docs
I do (for all my HP-UX perl distributions)
I will not object, but it should *NOT* block the build if -- |
From verdrehung@gmail.comIn fact this report is not about manipulating perl structures in use strict; my $dns = Net::DNS::Native->new(pool => 3); my @sock; for (1..300) { my $buf; This will work successfully if perl linked with pthreads and always 2014-10-05 9:48 GMT+07:00 Craig Berry via RT <perlbug-followup@perl.org>:
|
From verdrehung@gmail.comIn fact this report is not about manipulating perl structures in use strict; my $dns = Net::DNS::Native->new(pool => 3); my @sock; for (1..300) { my $buf; This will work successfully if perl linked with pthreads and always 2014-10-05 12:51 GMT+07:00 bulk88 via RT <perlbug-followup@perl.org>:
|
From verdrehung@gmail.com� �ооб�ении о� 5 ок��б�� 2014 09:48:32 ав�о� Craig Berry via RT напи�ал:
In fact this report is not about manipulating perl structures in use strict; my $dns = Net::DNS::Native->new(pool => 3); my @sock; for (1..300) { my $buf; This will work successfully if perl linked with pthreads and always |
From @LeontOn Sat, Oct 4, 2014 at 3:49 PM, �лег � <perlbug-followup@perl.org> wrote:
As far as I know, that issue is only common on a some platforms, but I may There is another reason to do this though: libpthread may override symbols Leon |
From verdrehung@gmail.com� �ооб�ении о� 5 ок��б�� 2014 21:10:46 ав�о� Oleg G напи�ал:
Today i played with gdb a little to find out what's going on here: And as gdb showed, app always crashed at rewind.c line 36: http://www.eglibc.org/cgi-bin/viewvc.cgi/branches/eglibc-2_13/libc/libio/rewind.c?annotate=12752 So, first is default and second for threaded code. And if i understood correctly this is how it works: I think other libc implementations has same behavior. And only the case is to link main application (perl in our case) with threads library P.S. |
From @LeontOn Mon, Oct 6, 2014 at 7:34 PM, Oleg G <verdrehung@gmail.com> wrote:
This all makes sense to me. Leon |
From verdrehung@gmail.com� �ооб�ении о� 4 ок��б�� 2014 20:49:15 ав�о� �лег � напи�ал:
I made a simple patch. See attachment. Is this acceptable feature in general? |
From verdrehung@gmail.com0001-Link-with-pthread-always-if-it-is-available-https-rt.patchFrom e8cd2fac0f79c44ab8e018ba0f702d3ba626ae13 Mon Sep 17 00:00:00 2001
From: Oleg G <verdrehung@gmail.com>
Date: Sun, 12 Oct 2014 19:37:20 +0700
Subject: [PATCH] Link with pthread always if it is available:
https://rt.perl.org/Public/Bug/Display.html?id=122906
---
Configure | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Configure b/Configure
index 95909f2..85e11c9 100755
--- a/Configure
+++ b/Configure
@@ -16841,6 +16841,14 @@ else
old_pthread_create_joinable=""
fi
+: do we need to link with pthreads
+if test "X$usethreads" != "X$define" -a "X$i_pthread" = "X$define"; then
+ case "$libs" in
+ *"-lpthread"*);;
+ *) libs="$libs -lpthread";;
+ esac
+fi
+
: see if pause exists
set pause d_pause
eval $inlibc
--
1.7.10.4
|
From @LeontOn Sun, Oct 12, 2014 at 3:05 PM, Oleg G <verdrehung@gmail.com> wrote:
No. It should only do this if there is in fact a libpthread available, and Leon |
From @TuxOn Sun, 12 Oct 2014 20:05:13 +0700, Oleg G <verdrehung@gmail.com> wrote:
No, pthread should be added to $libswanted like Inline Patch--- a/Configure 2014-10-13 08:21:29.769163741 +0200
+++ b/Configure 2014-10-13 08:22:22.831782753 +0200
@@ -1408,7 +1408,7 @@ libswanted_uselargefiles=''
: List of libraries we want.
: If anyone needs extra -lxxx, put those in a hint file.
libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
-libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
+libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD pthread"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
-- |
From verdrehung@gmail.com2014-10-13 5:19 GMT+07:00 Leon Timmermans via RT <perlbug-followup@perl.org>:
Thanks. I reworked my patch a little. So now it checks is libpthread |
From verdrehung@gmail.com0001-Always-link-with-libpthread-if-it-is-available-https.patchFrom 79503b158efe0204c5c597ef90295a7f0ac75a86 Mon Sep 17 00:00:00 2001
From: Oleg <verdrehung@gmail.com>
Date: Mon, 20 Oct 2014 14:32:20 +0700
Subject: [PATCH] Always link with libpthread if it is available:
https://rt.perl.org/Public/Bug/Display.html?id=122906
---
Configure | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/Configure b/Configure
index caa93a0..322bf7d 100755
--- a/Configure
+++ b/Configure
@@ -1025,6 +1025,7 @@ longsize=''
shortsize=''
issymlink=''
libc=''
+libpthread=''
ldlibpthname=''
libperl=''
shrpenv=''
@@ -1386,6 +1387,10 @@ test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib
: machines, like the mips. Usually, it should be empty.
plibpth=''
+: On most systems perl should be linked with pthreads to make available
+: using of threaded shared libraries
+libpthread="$define"
+
: default library list
libswanted=''
: some systems want to use only the non-versioned libso:s
@@ -16844,6 +16849,28 @@ else
old_pthread_create_joinable=""
fi
+: do we need to link with pthreads
+case "$libs" in
+ *"-lpthread"*) libpthread="$define";;
+ *)
+ if test "X$libpthread" = "X$define"; then
+ $cat >try.c <<EOM
+int main (int argc, char *argv[])
+{
+ return 0;
+}
+EOM
+ if $cc -o try $ccflags $ldflags -lpthread try.c >/dev/null 2>&1; then
+ echo "You has libpthread. Appending to \$libs." >&4
+ libs="$libs -lpthread"
+ else
+ libpthread=''
+ fi
+ $rm -f try try.*
+ fi
+ ;;
+esac
+
: see if pause exists
set pause d_pause
eval $inlibc
@@ -24168,6 +24195,7 @@ lib_ext='$lib_ext'
libc='$libc'
libperl='$libperl'
libpth='$libpth'
+libpthread='$libpthread'
libs='$libs'
libsdirs='$libsdirs'
libsfiles='$libsfiles'
@@ -24615,4 +24643,3 @@ $rm -f kit*isdone ark*isdone
$rm -rf UU
: End of Configure
-
--
1.8.4.4
|
From verdrehung@gmail.com2014-10-20 14:45 GMT+07:00 �лег � <verdrehung@gmail.com>:
Does anyone interested in this feature? If no, feel free to reject this ticket. |
@Tux - Status changed from 'open' to 'pending release' |
From @khwilliamsonThanks for submitting this ticket The issue should be resolved with the release today of Perl v5.22. If you find that the problem persists, feel free to reopen this ticket -- |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#122906 (status was 'resolved')
Searchable as RT122906$
The text was updated successfully, but these errors were encountered: