-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use IO#readline_nonblock instead of IO#readline when reading output f…
…rom CPI sub-processes. IO.#readline, being a blocking method, can cause a dealock when the cpi sends output without a line break. We had such issues with azure cpi.
- Loading branch information
Showing
4 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# Dummy cpi to test for a dealock scenario when a cpi sends an inclomplete line (missing line break) to STDOUT | ||
|
||
# Force the reading end to see incomplete line so that it blocks on 'readline' method | ||
# by $stdout.sync = true | ||
$stdout.sync = true | ||
$stdout.print('{"result":"OK","log":"LogMessage","error":null}') | ||
|
||
sleep 1 | ||
|
||
# send a massive amount of output to fill the pipe buffer (64 KB) so that this script blocks on the next line | ||
$stderr.print('abcdefghijklmnopqrstuwxyz' * 100000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters