avs-device-sdk icon indicating copy to clipboard operation
avs-device-sdk copied to clipboard

Adds rewind function to allow curl seek and retry sending data to server

Open jbfitb opened this issue 5 years ago • 1 comments

Issue

  • https://github.com/alexa/avs-device-sdk/issues/1526
  • About 1 in 10 Alexa requests fail on mobile devices.
  • Requests generally fail with one of two errors: curl error code 56 which is "receive error" or curl error code 65 which is "rewind failed"
  • I turned on ACSDK_EMIT_SENSITIVE_LOGS to output curl error messages and me help investigate what was going on
  • It looks like the errors (both 56 and 65) are accompanied with this message "necessary data rewind wasn't possible":
CurlEasyHandleWrapper:libcurl:id=AVSEvent-619,text=necessary data rewind wasn't possible
LibcurlHTTP2Request:getResponseCode:responseCode=0
LibcurlHTTP2Connection:streamFinished:streamId=AVSEvent-619,result=Error,CURLcode=56

Description of changes:

  1. Implemented callback functions for CURLOPT_SEEKFUNCTION
  2. Add a rewind function to the read callbacks
  3. Call seek on AttachmentReader when called from curl

Testing:

Was able to build and run automated tests. This seems to fix the issue. No more 56 or 65 errors.

jbfitb avatar Oct 18 '19 13:10 jbfitb

Hi @jbfitb,

Thank you for the pull request. Our process is to make changes internally and run all test before pushing the change to github in the form of a new release. I have added this to our internal tracking system to be assessed and prioritized.

Thanks, Kenneth

kclchan avatar Oct 18 '19 20:10 kclchan