Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Need to fine tune stream_select more. Make it exit sooner if the server is dead.
Comment | File | Size | Author |
---|---|---|---|
#19 | httprl-144662-19-fix-async-flag.patch | 982 bytes | mikeytown2 |
#13 | httprl-1446662-13-better-error-codes.patch | 18.62 KB | mikeytown2 |
#14 | httprl-1446662-14-better-error-codes.patch | 18.62 KB | mikeytown2 |
#8 | httprl-1446662-8-better-error-codes.patch | 12.24 KB | mikeytown2 |
#7 | httprl-1446662-7-better-error-codes.patch | 9.33 KB | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedDo something like this. We wait 1 second for any stream to be available; if none are available for I/O after 1 second, we then go into polling every 25ms 100 times. If nothing has happened by this point and no other streams are running we exit the loop.
Comment #2
hass CreditAttribution: hass commentedSounds releated to #1437658: options timeout set to (Float) 28.88858!?
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedIt is related to #1437658-4: options timeout set to (Float) 28.88858. The connection isn't happening but stream_select doesn't know that per say. Luckily stream_socket_get_name() seems that it can be used to detect when the server refuses the connection or drops it (I discovered this via trial and error).
Can you test this patch below? Should make HTTPRL faster for this use case.
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedAbove patch has been committed.
Comment #5
hass CreditAttribution: hass commentedI'm not a fan of your custom status codes at all and this is not like core. Can you use common codes and error messages that are Googleable too, please? Normally this is one of the below. Negative so it does not clash with the other between 100-5xx.
See http://technet.microsoft.com/en-us/library/cc723430.aspx for some of these well known, please.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedCode comes from core
http://api.drupal.org/api/drupal/includes!common.inc/constant/HTTP_REQUE...
And patches
#1096890-15: drupal_http_request should return error if reaches max allowed redirects
I just followed this pattern. I'm very open to doing this the right way.
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedMore descriptive listing http://msdn.microsoft.com/en-us/library/aa924071.aspx
This is the patch, let me know what you think.
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedMore work on error codes.
Comment #9
hass CreditAttribution: hass commentedWhat will happen if the server returns any other winsock error? Let's say 10065? Adding more and more constants seems to be the wrong way to me.
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedOdds are that will be caught by HTTPRL_CONNECTION_REFUSED -10061. There isn't a way to get all winsock errors when using the ASYNC flag; best I can do is infer what the problem might be. I've tried most of the http://php.net/stream functions seeing if I can get the error state from them and I haven't found a function that will do this for me. The fact that http://php.net/stream-socket-get-name can be used to detect errors like this is a nice side effect.
Comment #11
hass CreditAttribution: hass commentedWhile looking on older comments... It's so inconsistent what we are doing... See http://drupal.org/node/1428474#comment-5590436 where i've got a winsock 10035. Just logic wise this implementation is really no fun... One status code here, others there and so on... really hard to develop and test :-((( it's not possible to grab it always the same way? Good night.
Comment #12
mikeytown2 CreditAttribution: mikeytown2 commented10035 is what was returned from stream_socket_client(). It is a https connection thus the ASYNC flag may not be used as I will try again without ASYNC if this is a https connection. Your complaining about something I don't have any control over in short. If stream_socket_client() gives me an error I pass that along. If it doesn't I keep going, relying on stream_socket_get_name and timeouts in short to see if the stream is in an error state. For your case, you can use drupal_http_request to get the error; or we could have an option to set a sync flag if you want, just be advised that HTTPRL's speed will be reduced significantly on the connection side, in this function httprl_request(). The speed of httprl_send_request() will not be affected by the ASYNC flag.
Comment #13
mikeytown2 CreditAttribution: mikeytown2 commentedPatch adds in the error codes, re-worked the $flags variable, added in the async_connect option, optimized the
foreach ($streams as $id => $fp)
loop.Testing the new flag.
Time
Async: 2.89282
Sync: 3.85309
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedfixed a small typo in the documentation.
Comment #15
mikeytown2 CreditAttribution: mikeytown2 commented#14 has been committed.
Comment #16
mikeytown2 CreditAttribution: mikeytown2 commentedhttp://drupalcode.org/project/httprl.git/commitdiff/86ad60fd6b0eca137db0...
Comment #17
hass CreditAttribution: hass commentedHow can I have link failures like this if it works with wget properly? I also see very many 10060.
Comment #18
mikeytown2 CreditAttribution: mikeytown2 commentedThat url works correctly on my test server.
Comment #19
mikeytown2 CreditAttribution: mikeytown2 commentedfix for async connections. This has been committed.