简体   繁体   中英

Google API Curl timed out

Since yesterday I have been seeing a lot of these errors in my logs:

Operation timed out after 100001 milliseconds with 0 bytes received
File: /var/www/html/vendor/google/apiclient/src/Google/IO/Curl.php(126)
Trace: #0 /var/www/html/vendor/google/apiclient/src/Google/IO/Abstract.php(136): Google_IO_Curl->executeRequest(Object(Google_Http_Request))
#1 /var/www/html/vendor/google/apiclient/src/Google/Http/REST.php(60): Google_IO_Abstract->makeRequest(Object(Google_Http_Request))
#2 /var/www/html/vendor/google/apiclient/src/Google/Task/Runner.php(174): Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request))
#3 /var/www/html/vendor/google/apiclient/src/Google/Http/REST.php(46): Google_Task_Runner->run()
#4 /var/www/html/vendor/google/apiclient/src/Google/Client.php(593): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request))
#5 /var/www/html/vendor/google/apiclient/src/Google/Service/Resource.php(240): Google_Client->execute(Object(Google_Http_Request))
#6 /var/www/html/vendor/google/apiclient/src/Google/Service/Drive.php(2000): Google_Service_Resource->call('update', Array, 'Google_Service_...')
#7 /var/www/html/app/lib/GoogleDriveHelper.php(185): Google_Service_Drive_Files_Resource->update('1jbLDzGVNNNigA...', Object(Google_Service_Drive_DriveFile), Array)
#8 /var/www/html/app/lib/GoogleDriveHelper.php(131): GoogleDriveHelper->updateFile('1jbLDzGVNNNigA...', '/tmp/tr-filesUI...')
#9 /var/www/html/app/lib/GoogleDriveHelper.php(66): GoogleDriveHelper->createOrUpdateFileOnce('Folder/Photo_...', 'Filen...', '/tmp/tr-filesUI...', 'image/jpeg', '', true)
#10 /var/www/html/app/jobs/worker/taskresult-photo-upload-to-gdrive.php(170): GoogleDriveHelper->createOrUpdateFile('Folder/Photo_...', 'Filen...', '/tmp/tr-filesUI...', 'image/jpeg')
#11 [internal function]: upload_photos_to_gdrive(Object(GearmanJob), NULL)
#12 /var/www/html/app/jobs/uploads-worker.php(5): GearmanWorker->work()

I have tried checking Google Services status page and there are no reported issues. I haven't seen this exception occur before and nothing on my side has changed.

I should note that this only happens quite rarely and sometimes Google Drive responds with 502 error status code and the following message:

<p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>

Maybe you have been tackling this issue and could point me to explanation of what is happening, is this preventable (if so - how) or are these issues on my side of services?

There is nothing you can do about 500 errors they are an error on googles side. As recommended in the documentation you should implement exponential backoff.

If you get a 500 error wait a few seconds and try again. If it still doesn't work wait double the amount of time if it still doesn't work wait three times the amount of time.

If after say 15 attempts it still doesn't work then something is probably down. exponential-backoff

The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM