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

Fix stuck precomp on osx #1076

Merged
merged 1 commit into from May 6, 2017

Conversation

Projects
None yet
3 participants
@ugexe
Member

ugexe commented May 6, 2017

No description provided.

@ugexe ugexe requested a review from niner May 6, 2017

@niner

From the patch I assume that the issue was that there was output on STDERR during the compilation, but the compilation did not actually fail, so we did not read all STDERR output in this case somehow causing the hang?

The patch looks absolutely OK. I would just like the commit message to answer the above question.

@ugexe

This comment has been minimized.

Show comment
Hide comment
@ugexe

ugexe May 6, 2017

Member

I can't answer that question, as I don't know why it works. I've just done a similar pattern more than once over the years having encountered osx + proc issues before.

In this case $proc.out.lines.unique; is where it gets stuck, but reading and/or closing :err first seems to correct the behavior.

Member

ugexe commented May 6, 2017

I can't answer that question, as I don't know why it works. I've just done a similar pattern more than once over the years having encountered osx + proc issues before.

In this case $proc.out.lines.unique; is where it gets stuck, but reading and/or closing :err first seems to correct the behavior.

@ugexe

This comment has been minimized.

Show comment
Hide comment
@ugexe

ugexe May 6, 2017

Member

I golfed this down, and it affects more than just osx:

# WORKS
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 1000000;"|, :out; my @out = $proc.out.lines.unique;'

# WORKS
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 100;"|, :out, :err; my @out = $proc.out.lines.unique;'

# STUCK
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 1000000;"|, :out, :err; my @out = $proc.out.lines.unique;'

A comment from irc explaining what is likely happening:

12:04:53      geekosaur | if the unread output on the pipe connected to its stderr
is larger than the OS pipe buffer then the child process will block waiting for the
pipe to become writable; the parent is probably doing a waitpid() on all children,
which will never finish because of the blocked child. only way around it is read
the pipe or forcibly terminate the child with a signal
Member

ugexe commented May 6, 2017

I golfed this down, and it affects more than just osx:

# WORKS
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 1000000;"|, :out; my @out = $proc.out.lines.unique;'

# WORKS
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 100;"|, :out, :err; my @out = $proc.out.lines.unique;'

# STUCK
perl6 -e 'my $proc = shell q|perl6 -e "die q!oo! xx 1000000;"|, :out, :err; my @out = $proc.out.lines.unique;'

A comment from irc explaining what is likely happening:

12:04:53      geekosaur | if the unread output on the pipe connected to its stderr
is larger than the OS pipe buffer then the child process will block waiting for the
pipe to become writable; the parent is probably doing a waitpid() on all children,
which will never finish because of the blocked child. only way around it is read
the pipe or forcibly terminate the child with a signal

@niner niner merged commit 824cfa3 into nom May 6, 2017

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ugexe ugexe deleted the bugfix/osx-unstuck-precomp branch May 6, 2017

@LLFourn

This comment has been minimized.

Show comment
Hide comment
@LLFourn

LLFourn May 7, 2017

Contributor

fwiw I RT'd the above behaviour on OSX a while ago:

https://rt.perl.org/Public/Bug/Display.html?id=127682

Contributor

LLFourn commented May 7, 2017

fwiw I RT'd the above behaviour on OSX a while ago:

https://rt.perl.org/Public/Bug/Display.html?id=127682

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