google-cloud-php icon indicating copy to clipboard operation
google-cloud-php copied to clipboard

cURL error 28: Operation timed out after 12001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) when sending in timeseries for custom metrics

Open sleenen opened this issue 6 years ago • 7 comments

I have a background job running every minute sending in time series for a custom metric, every once in a while I get the error cURL error 28: Operation timed out after 12001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 12001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
#26 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(200): createRejection
#25 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(155): finishError
#24 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(105): finish
#23 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(201): processMessages
#22 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(130): tick
#21 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(145): execute
#20 vendor/guzzlehttp/promises/src/Promise.php(246): invokeWaitFn
#19 vendor/guzzlehttp/promises/src/Promise.php(223): waitIfPending
#18 vendor/guzzlehttp/promises/src/Promise.php(267): invokeWaitList
#17 vendor/guzzlehttp/promises/src/Promise.php(225): waitIfPending
#16 vendor/guzzlehttp/promises/src/Promise.php(62): wait
#15 vendor/google/cloud-monitoring/src/V3/Gapic/MetricServiceGapicClient.php(919): createTimeSeries

Environment details

  • OS: alpine
  • PHP version: 7.3
  • Package name and version: google/cloud-monitoring:0.19.0

Steps to reproduce

Running code below in a schedule every minute.

Code example

use Google\Api\Metric;
use Google\Api\MonitoredResource;
use Google\Cloud\Monitoring\V3\MetricServiceClient;
use Google\Cloud\Monitoring\V3\Point;
use Google\Cloud\Monitoring\V3\TimeInterval;
use Google\Cloud\Monitoring\V3\TimeSeries;
use Google\Cloud\Monitoring\V3\TypedValue;
use Google\Protobuf\Timestamp;

$value = 1;
$projectId = env('GOOGLE_CLOUD_PROJECT_ID', '');

$metrics = new MetricServiceClient([
    'projectId' => $projectId,
]);

$projectName = $metrics->projectName($projectId);

$endTime = new Timestamp();
$endTime->setSeconds(time());
$interval = new TimeInterval();
$interval->setEndTime($endTime);

$value = new TypedValue();
$value->setInt64Value($value;

$point = new Point();
$point->setValue($value);
$point->setInterval($interval);
$points = [$point];

$metric = new Metric();
$metric->setType('custom.googleapis.com/custom/something');

$resource = new MonitoredResource();
$resource->setType('global');

$timeSeries = new TimeSeries();
$timeSeries->setMetric($metric);
$timeSeries->setResource($resource);
$timeSeries->setPoints($points);

$result = $metrics->createTimeSeries(
    $projectName,
    [$timeSeries]);

sleenen avatar Jan 14 '20 11:01 sleenen

Having the same issue

kotevcode avatar Jan 26 '20 10:01 kotevcode

Sorry for the belated response!

@sleenen @shahafan what environment are you hosting your apps in? I see alpine, so a docker container, but are you running the container on your local machine, on another cloud, or in Google Compute Engine?

jdpedrie avatar Jan 27 '20 18:01 jdpedrie

@jdpedrie No worries, thanks for your reply. It's running in GKE (Kubernetes cluster in Google Cloud). This exception will come a few times per day I'd say.

sleenen avatar Jan 27 '20 20:01 sleenen

@jdpedrie Coogle compute engine, happens to me when reading from storage bucket.

kotevcode avatar Jan 28 '20 11:01 kotevcode

Thanks for answering,

I believe this may be related to #2338. It's being investigated internally. We will keep you posted on what is found!

jdpedrie avatar Jan 28 '20 14:01 jdpedrie

Same problem, Google compute engine when trying to list instances.

vipzen avatar Feb 15 '20 22:02 vipzen

This issue appears to be related to #2338. I'm going to close this out, please continue to track the other issue!

jdpedrie avatar Apr 23 '20 19:04 jdpedrie