Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a recoverable fatal on curl_init_pooled
Summary:curl_init_pooled has an unfortunate failure mode, when the pool is exhausted the entire request fatals. This prevents the application from gracefully handling the failure. The application could disable the feature rather than canceling the entire request. In general fatal errors should be reserved for cases where it is impossible to continue processing the request, not simply because something went wrong. This switches the fatal to a RuntimeException. Closes #6920 Reviewed By: Orvid Differential Revision: D3066969 fb-gh-sync-id: 7c3b92cad44627cb3ba67c88f847e5e500522ab0 fbshipit-source-id: 7c3b92cad44627cb3ba67c88f847e5e500522ab0
- Loading branch information
1 parent
2d96e5f
commit a4f8942
Showing
5 changed files
with
15 additions
and
6 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
4 changes: 3 additions & 1 deletion
4
hphp/test/slow/ext_curl/curl_handles_in_different_pools_dont_interfere.php.expectf
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
string(7) "foo.com" | ||
string(7) "bar.com" | ||
|
||
Fatal error: Timeout reached waiting for an available pooled curl connection! %s | ||
Fatal error: Uncaught exception 'RuntimeException' with message 'Timeout reached waiting for an available pooled curl connection!' in %s/hphp/test/slow/ext_curl/curl_handles_in_different_pools_dont_interfere.php:9 | ||
Stack trace: | ||
#0 {main} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
// the curl pool is 1, so the second request will fatal | ||
// the curl pool is 1, so the second request will throw RuntimeException | ||
$ch = curl_init_pooled('test', 'foo.bar.com'); | ||
$ch2 = curl_init_pooled('test', 'www.baz.com'); |
5 changes: 4 additions & 1 deletion
5
hphp/test/slow/ext_curl/get_pooled_curl_timeout_works.php.expectf
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
Fatal error: Timeout reached waiting for an available pooled curl connection! %s | ||
|
||
Fatal error: Uncaught exception 'RuntimeException' with message 'Timeout reached waiting for an available pooled curl connection!' in %s/hphp/test/slow/ext_curl/get_pooled_curl_timeout_works.php:4 | ||
Stack trace: | ||
#0 {main} |
4 changes: 3 additions & 1 deletion
4
hphp/test/slow/ext_curl/pools_can_be_configured_independently.php.expectf
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
here | ||
|
||
Fatal error: Timeout reached waiting for an available pooled curl connection!%s | ||
Fatal error: Uncaught exception 'RuntimeException' with message 'Timeout reached waiting for an available pooled curl connection!' in %s/hphp/test/slow/ext_curl/pools_can_be_configured_independently.php:6 | ||
Stack trace: | ||
#0 {main} |