Re: why thread is not usable in perl5 of OpenBSD6.4?

2018-11-27 Thread Marc Espie
On Sun, Nov 25, 2018 at 09:32:33PM -0800, Philip Guenther wrote:
> On Sun, Nov 25, 2018 at 1:57 AM 岡本健二  wrote:
> 
> > I have to use thread on the perl5 of OpenBSD 6.4.
> > However, it was disabled on the distribution.
> >
> 
> Hmm, is this something that worked in previous releases, or is something
> that you've only tried in OpenBSD 6.4?
> 
> Off-hand, it's still disabled by default in the Configure script that perl
> people ship, and I don't see anything in the OpenBSD bits to override their
> choice.
> 
> 
> 
> > I tried to make the thread active to recompile the perl5 with -Dusethreads,
> > which led me to many test fails.
> >
> 
> Were there tests that failed with -Dusethreads that passed when that wasn't
> used?  If so, which, and what was their output?
> 
> To put it another way: if you're suggesting that we build the base perl
> with -Dusethreads, what are the consequences of that?  Test failures?
> Bigger binary?  pkg_add is slower?
> 
> 
> Why the thread function was disabled in this release?
> > Is it security reason?
> >
> 
>  Upstream has it off by default, nothing so far has needed it, and it makes
> things slower (or at least that's why upstream says).  Why would we enable
> it?

No, perl threads is generally considered to be unreliable.

Unless this changed recently, there's zero reason to activate it by default.

As far as I know, the only reason it still exists is because of less
endowed operating systems that do not have fork.



Re: why thread is not usable in perl5 of OpenBSD6.4?

2018-11-26 Thread 岡本健二
Thank you very much gunther and Philip for your technical response to my
question.
Ok, thread support is not recommended officially, then I follow it.

I just watnted it, because Ubuntu linux support it etc., and I'd like to use
a perl script of 2chproxy.pl at github.com.
-
for a convenience, I include a diff file, which is made by the procedure
below:
make -f Makefile.bsd-wrapper
make test >file1 2>&1
--
Add -Dusethreads at the end of CONFIG_ARG parameter of Makefile.bsd-wrapper
make -f Makefile.bsd-wrapper
make test >file2 2>&1
(This tread support perl can do
use threads;
without error, after make install)
diff file1 file2 >ken.diff

Kenji


2018年11月27日(火) 2:26 Andrew Hewus Fresh :

> On Sun, Nov 25, 2018 at 09:32:33PM -0800, Philip Guenther wrote:
> > On Sun, Nov 25, 2018 at 1:57 AM 岡本健二  wrote:
> >
> > > I have to use thread on the perl5 of OpenBSD 6.4.
> > > However, it was disabled on the distribution.
> > >
> >
> > Hmm, is this something that worked in previous releases, or is something
> > that you've only tried in OpenBSD 6.4?
> >
> > Off-hand, it's still disabled by default in the Configure script that
> perl
> > people ship, and I don't see anything in the OpenBSD bits to override
> their
> > choice.
>
>
> One of the main reasons is that the "use of interpreter-based threads in
> perl is officially discouraged" and has been unofficially discouraged
> for a lot longer.
>
> http://perldoc.perl.org/threads.html#WARNING
>
> My understanding of the reason it is discouraged is that the threading
> mechanism in perl does not lend itself to correct code and you're
> probably better off doing something simpler and getting nearly as good
> results using another mechanism.
>
>
>
> > > I tried to make the thread active to recompile the perl5 with
> -Dusethreads,
> > > which led me to many test fails.
> > >
> >
> > Were there tests that failed with -Dusethreads that passed when that
> wasn't
> > used?  If so, which, and what was their output?
>
> The perl test suite does not like to run in the OpenBSD source tree, I
> don't recall why off the top of my head, just that it doesn't.  If you
> had failures that are different than you get without enabling threads,
> that might be interesting to diagnose.
>
>
> > To put it another way: if you're suggesting that we build the base perl
> > with -Dusethreads, what are the consequences of that?  Test failures?
> > Bigger binary?  pkg_add is slower?
>
> It does make perl anecdotally 10% slower overall (as I recall) for non
> threaded operations.  Obviously that depends on the workload, but since
> we don't use them, making pkg_add and other things that use perl faster
> seems more useful.
>
> http://perldoc.perl.org/perlthrtut.html#Performance-considerations
>
>
>
>
> > Why the thread function was disabled in this release?
> > > Is it security reason?
> > >
> >
> >  Upstream has it off by default, nothing so far has needed it, and it
> makes
> > things slower (or at least that's why upstream says).  Why would we
> enable
> > it?
>
>
> See above for more reasoning and you might look at p5-Coro if you
> really need threads, I haven't had a need for them but have heard they
> work better than the core implementation.
>
> https://metacpan.org/pod/Coro
>
> l8rZ,
> --
> andrew - http://afresh1.com
>
> People who invent random theories which only defend the vendor must have
> been beaten as children.  Beaten with sticks.
> At least, that's my theory.
>   -- Theo De Raadt
>


ken.diff
Description: Binary data


Re: why thread is not usable in perl5 of OpenBSD6.4?

2018-11-26 Thread Andrew Hewus Fresh
On Sun, Nov 25, 2018 at 09:32:33PM -0800, Philip Guenther wrote:
> On Sun, Nov 25, 2018 at 1:57 AM 岡本健二  wrote:
> 
> > I have to use thread on the perl5 of OpenBSD 6.4.
> > However, it was disabled on the distribution.
> >
> 
> Hmm, is this something that worked in previous releases, or is something
> that you've only tried in OpenBSD 6.4?
> 
> Off-hand, it's still disabled by default in the Configure script that perl
> people ship, and I don't see anything in the OpenBSD bits to override their
> choice.


One of the main reasons is that the "use of interpreter-based threads in
perl is officially discouraged" and has been unofficially discouraged
for a lot longer.

http://perldoc.perl.org/threads.html#WARNING

My understanding of the reason it is discouraged is that the threading
mechanism in perl does not lend itself to correct code and you're
probably better off doing something simpler and getting nearly as good
results using another mechanism.



> > I tried to make the thread active to recompile the perl5 with -Dusethreads,
> > which led me to many test fails.
> >
> 
> Were there tests that failed with -Dusethreads that passed when that wasn't
> used?  If so, which, and what was their output?
 
The perl test suite does not like to run in the OpenBSD source tree, I
don't recall why off the top of my head, just that it doesn't.  If you
had failures that are different than you get without enabling threads,
that might be interesting to diagnose.


> To put it another way: if you're suggesting that we build the base perl
> with -Dusethreads, what are the consequences of that?  Test failures?
> Bigger binary?  pkg_add is slower?

It does make perl anecdotally 10% slower overall (as I recall) for non
threaded operations.  Obviously that depends on the workload, but since
we don't use them, making pkg_add and other things that use perl faster
seems more useful.

http://perldoc.perl.org/perlthrtut.html#Performance-considerations




> Why the thread function was disabled in this release?
> > Is it security reason?
> >
> 
>  Upstream has it off by default, nothing so far has needed it, and it makes
> things slower (or at least that's why upstream says).  Why would we enable
> it?


See above for more reasoning and you might look at p5-Coro if you
really need threads, I haven't had a need for them but have heard they
work better than the core implementation.

https://metacpan.org/pod/Coro

l8rZ,
-- 
andrew - http://afresh1.com

People who invent random theories which only defend the vendor must have
been beaten as children.  Beaten with sticks.
At least, that's my theory.
  -- Theo De Raadt



Re: why thread is not usable in perl5 of OpenBSD6.4?

2018-11-25 Thread Philip Guenther
On Sun, Nov 25, 2018 at 1:57 AM 岡本健二  wrote:

> I have to use thread on the perl5 of OpenBSD 6.4.
> However, it was disabled on the distribution.
>

Hmm, is this something that worked in previous releases, or is something
that you've only tried in OpenBSD 6.4?

Off-hand, it's still disabled by default in the Configure script that perl
people ship, and I don't see anything in the OpenBSD bits to override their
choice.



> I tried to make the thread active to recompile the perl5 with -Dusethreads,
> which led me to many test fails.
>

Were there tests that failed with -Dusethreads that passed when that wasn't
used?  If so, which, and what was their output?

To put it another way: if you're suggesting that we build the base perl
with -Dusethreads, what are the consequences of that?  Test failures?
Bigger binary?  pkg_add is slower?


Why the thread function was disabled in this release?
> Is it security reason?
>

 Upstream has it off by default, nothing so far has needed it, and it makes
things slower (or at least that's why upstream says).  Why would we enable
it?


Philip Guenther