[ https://issues.apache.org/jira/browse/FELIX-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Derek Baum resolved FELIX-2380. ------------------------------- Resolution: Fixed resolved by reflectively calling PipedInputStream.receivedLast(), which notifies the writer and stops it waiting. > [gogo] lock contention in piped writer when reader doesn't read all input > ------------------------------------------------------------------------- > > Key: FELIX-2380 > URL: https://issues.apache.org/jira/browse/FELIX-2380 > Project: Felix > Issue Type: Bug > Components: Gogo > Reporter: Derek Baum > Assignee: Derek Baum > Priority: Minor > Fix For: gogo-0.6.0 > > > The following completes almost immediately: > g! cat conf/config.properties | grep Apache > # Licensed to the Apache Software Foundation (ASF) under one > # to you under the Apache License, Version 2.0 (the > true > but adding the --quiet flag to grep makes it take 1000mS longer: > g! cat conf/config.properties | grep --quiet Apache > true > This is because grep stops reading its input as soon as it has seen the first > match when --quiet is given. > The same delay also occurs if you pipe into a command that doesn't read its > input: > g! cat conf/config.properties | echo > The contention occurs because the writer (cat) is blocked on wait(1024) in > PipedInputStream when the 1024 byte buffer is full. It is only unblocked when > the reader (grep) reads more input. It is NOT unblocked when the reader > closes the piped input. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.