Join BoxWorks in San Francisco Nov 12-13! Keynotes, product demos, and Box Master Classes. Reserve your spot!

why would the API stop responding?

New post

Comments

3 comments

  • JohannesMaria

    Hi Faceless,

     

    since you got a blank response, the path to our servers broke. You will always get a response back from our servers, either a success or some kind of error message. Blank or null responses are an indication of network connectivity issues. The only exception to this would be our status to be shown somehow unavailable. You can check this on the status.box.com

     

     

     

     

     

    0
    Comment actions Permalink
  • faceless105

    Is there any recommended way to work around this? I've tried a few routes, including a single retry (don't want to get stuck in any infinite loops), and waiting 10 seconds then retrying. The box status seems to be all good every time, so I think you're right on it being a broken path, but form the programming stand point, I'm not exactly sure what that means and how to work around it.

     

    Here's some output from the last time it happened.. The server response was null, and this is the cURL info. It's pretty empty. I really thought having it wait 10 seconds then retrying would allow the problem to self correct.

     

    each time I'm connecting for a new request, it's a new cURL connection, and the connection is properly closed each time. There shouldn't be any lingering connection info that didn't get cleared out. The problem seems intermittent. I haven't been able to find any pattern or trigger for it. Also since it just doesn't respond, I don't have any error message to work with either. I'd really like to find a way to make this work, so any help would be greatly appreciated.

     

    cURL Info:

    array (size=26)
      'url' => string 'https://upload.box.com/api/2.0/files/content' (length=44)
      'content_type' => null
      'http_code' => int 0
      'header_size' => int 0
      'request_size' => int 0
      'filetime' => int 0
      'ssl_verify_result' => int 0
      'redirect_count' => int 0
      'total_time' => float 0
      'namelookup_time' => float 0
      'connect_time' => float 0
      'pretransfer_time' => float 0
      'size_upload' => float 0
      'size_download' => float 0
      'speed_download' => float 0
      'speed_upload' => float 0
      'download_content_length' => float -1
      'upload_content_length' => float -1
      'starttransfer_time' => float 0
      'redirect_time' => float 0
      'redirect_url' => string '' (length=0)
      'primary_ip' => string '' (length=0)
      'certinfo' => 
        array (size=0)
          empty
      'primary_port' => int 0
      'local_ip' => string '' (length=0)
      'local_port' => int 0

      

    0
    Comment actions Permalink
  • JohannesMaria

     

    This is a question on where you are running your application. I'd recommend to use a big cloud provider like AWS, Azure, Google Cloud, Digital Ocean, Heroku, etc.

     

    If you are dependent on a single ISP connection, your ISP is probably the most likely cause.

     

    If you cannot change to a cloud provider, use an exponential retry pattern like retry_time = a ^ n, with n = 1, 2, 3, ... max retries; and a = 2 or e.

     

    That will most likely help against intermittent outages.

     

    hih

     

    0
    Comment actions Permalink

Please sign in to leave a comment.