why would the API stop responding?
I've been working on an application to copy some files up to a box location. The files are all relatively small, probably on average around 1mb each. There's maybe 2,000 files. I've been getting inconsistent results when I do a bulk upload where at some point the API just stops responding it seems.
This is done in PHP. When there's an error of unexpected results, I have it dump everything out, and what's weird is that there's no response from the server. As part of this process, I'm creating folders and uploading files.
At first I thought maybe I was hitting a rate limit, but looking around, it seems like those are well, undefined, but still, pretty liberal. I also would expect some kind of return message.
Then I thought maybe it was my session expiring, but I have a script that'll check and when the session is within 20 minutes of expiring, it'll refresh the session, so I'm able to rule that out.
Is there something else I should be looking for? What might cause the response to be blank?
-
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
-
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
-
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
サインインしてコメントを残してください。
コメント
3件のコメント