Skip to content
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

awaiting a Promise in a different thread sometimes hangs #3503

Closed
p6rt opened this issue Sep 5, 2014 · 14 comments
Closed

awaiting a Promise in a different thread sometimes hangs #3503

p6rt opened this issue Sep 5, 2014 · 14 comments

Comments

@p6rt
Copy link

p6rt commented Sep 5, 2014

Migrated from rt.perl.org#122709 (status was 'resolved')

Searchable as RT122709$

@p6rt
Copy link
Author

p6rt commented Sep 5, 2014

From @lizmat

(since leont has been so busy with other stuff, I thought to report the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed in the same thread that created the Proc​::Async
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter = Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start; await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to rakudobugperl.org?
13​:30 leont Sure

@p6rt
Copy link
Author

p6rt commented Sep 5, 2014

From @lizmat

at.png

@p6rt
Copy link
Author

p6rt commented Apr 26, 2016

From @coke

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 26, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 27, 2016

From @LLFourn

Not sure if it's relevant here but last time I checked there is an issues
with await and Proc​::Async on Mac.

RT #​125758 for example which looks similar to this.
On Wed, 27 Apr 2016 at 7​:08 AM, Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello
World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 27, 2016

From @LLFourn

Now I'm at home I tried it on my Mac, I can confirm that​:

perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello
World>).start; await start { await $waiter }'

prints Hello World and then hangs forever.

On Wed, Apr 27, 2016 at 2​:58 PM Lloyd Fournier <lloyd.fourn@​gmail.com>
wrote​:

Not sure if it's relevant here but last time I checked there is an issues
with await and Proc​::Async on Mac.

RT #​125758 for example which looks similar to this.
On Wed, 27 Apr 2016 at 7​:08 AM, Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello
World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 2, 2016

From @coke

On Wed Apr 27 03​:02​:14 2016, lloyd.fourn@​gmail.com wrote​:

Now I'm at home I tried it on my Mac, I can confirm that​:

perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello
World>).start; await start { await $waiter }'

prints Hello World and then hangs forever.

On Wed, Apr 27, 2016 at 2​:58 PM Lloyd Fournier <lloyd.fourn@​gmail.com>
wrote​:

Not sure if it's relevant here but last time I checked there is an issues
with await and Proc​::Async on Mac.

RT #​125758 for example which looks similar to this.
On Wed, 27 Apr 2016 at 7​:08 AM, Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello
World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

Can you include the output of sw_vers and perl6 --version ?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 2, 2016

From @smls

For me, the command sometimes hangs and sometimes doesn't.

This is on up-do-date Rakudo​:

  ➜ uname -srm
  Linux 4.5.2-1-ARCH x86_64
 
  ➜ perl6 --version
  This is Rakudo version 2016.04-74-ga16f0a4 built on MoarVM version 2016.04
  implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented May 6, 2016

From @LLFourn

It works now!

whoever fixed it++. Close this! (and #​125758).

On Mon, May 2, 2016 at 11​:34 PM Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Wed Apr 27 03​:02​:14 2016, lloyd.fourn@​gmail.com wrote​:

Now I'm at home I tried it on my Mac, I can confirm that​:

perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello
World>).start; await start { await $waiter }'

prints Hello World and then hangs forever.

On Wed, Apr 27, 2016 at 2​:58 PM Lloyd Fournier <lloyd.fourn@​gmail.com>
wrote​:

Not sure if it's relevant here but last time I checked there is an
issues
with await and Proc​::Async on Mac.

RT #​125758 for example which looks similar to this.
On Wed, 27 Apr 2016 at 7​:08 AM, Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello
World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

Can you include the output of sw_vers and perl6 --version ?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 6, 2016

From @lizmat

FWIW, I think it was 1ee27e660a8dce3ae

On 06 May 2016, at 11​:55, Lloyd Fournier <lloyd.fourn@​gmail.com> wrote​:

It works now!

whoever fixed it++. Close this! (and #​125758).

On Mon, May 2, 2016 at 11​:34 PM Will Coleda via RT <perl6-bugs-followup@​perl.org> wrote​:
On Wed Apr 27 03​:02​:14 2016, lloyd.fourn@​gmail.com wrote​:

Now I'm at home I tried it on my Mac, I can confirm that​:

perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello
World>).start; await start { await $waiter }'

prints Hello World and then hangs forever.

On Wed, Apr 27, 2016 at 2​:58 PM Lloyd Fournier <lloyd.fourn@​gmail.com>
wrote​:

Not sure if it's relevant here but last time I checked there is an issues
with await and Proc​::Async on Mac.

RT #​125758 for example which looks similar to this.
On Wed, 27 Apr 2016 at 7​:08 AM, Will Coleda via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Fri Sep 05 14​:44​:06 2014, elizabeth wrote​:

(since leont has been so busy with other stuff, I thought to report
the problem he found)

12​:11 * leont suspects he's observing Promise.allof spinlocking or
some such. 100% CPU usage, but no input is coming in :-/
12​:19 lizmat leont​: could you gist that ?
12​:22 leont Would need to reduce it first, but sure
13​:14 leont My spinlock seems to have gone away when I await()ed
in the same thread that created the Proc​::Async…
13​:16 lizmat leont​: interesting datapoint :-)
13​:16 wonder what jnthn would want to say about that :-)
13​:22 leont perl6 -e 'my $waiter =
Proc​::Async.new(​:path($*EXECUTABLE), :args(["helper.pl"])).start;
await start { await $waiter };'
13​:23 Let's make that easier​: perl6 -e 'my $waiter =
Proc​::Async.new(​:path("echo"), :args(<Hello World>)).start; await
start { await $waiter };'
13​:29 moritz leont++ # golfing
13​:30 leont​: could you please submit that to
rakudobugperl.org?
13​:30 leont Sure

This seems to work with no issue here. Is this ticket closable?

$ perl6 -e 'my $waiter = Proc​::Async.new(​:path("echo"), :args(<Hello
World>)).start; await start { await $waiter };'
Hello World

--
Will "Coke" Coleda

Can you include the output of sw_vers and perl6 --version ?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 6, 2016

From @smls

No, this one-liner...

  perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello World>).start; await start { await $waiter }'

...still occasionally hangs for me on the latest Rakudo nom​:

  This is Rakudo version 2016.04-117-g7db7b46 built on MoarVM version 2016.04
  implementing Perl 6.c.

But it does appear to happen more seldomly now.
Make sure you run it many times before concluding that it works for you.

@p6rt
Copy link
Author

p6rt commented Aug 3, 2016

From @jnthn

On Fri May 06 06​:54​:52 2016, smls75@​gmail.com wrote​:

No, this one-liner...

perl6 -e 'my $waiter = Proc​::Async.new(​:path<echo>, :args<Hello
World>).start; await start { await $waiter }'

...still occasionally hangs for me on the latest Rakudo nom​:

This is Rakudo version 2016.04-117-g7db7b46 built on MoarVM version
2016.04
implementing Perl 6.c.

But it does appear to happen more seldomly now.
Make sure you run it many times before concluding that it works for
you.

I can still reproduce it too; seems that occasionally the scheduler starts too few threads (in fact, only one, and that is tied up with the await, and so nothing processes the incoming message saying the process ended).

@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

From @jnthn

On Wed, 03 Aug 2016 12​:23​:32 -0700, jnthn@​jnthn.net wrote​:

I can still reproduce it too; seems that occasionally the scheduler
starts too few threads (in fact, only one, and that is tied up with
the await, and so nothing processes the incoming message saying the
process ended).

The new scheduler merged a couple weeks back addresses this; added a test in S17-procasync/stress.t.

@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

@jnthn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant