HTTP Request keep alive issue 4D v17R6

Wat is the general word on using keep alive with HTTP Request?

I’ve stumbled upon a problem in v17R6 (macOS 10.13.6) which reads a google mailbox using oath2 at regular intervals (10 minutes). The original 4D v15 version used Keisuke’s cURL ran for years and never had issues.

I recently upgraded to 4D v17R6 and replaced cURL with HTTP Request. The first run is fine, but the following run fails and raises a 4D error ‘#17 Unimplemented control instruction’ or ‘#42 Too many files open’ (no 4D error handler installed) for a HTTP Get on The following attempt works fine again, but later on the same issue.
I fiddled a bit with the run frequency and found that if the time between two executions is less than 4 minutes there are no more errors. But when it is set to more than 4 minutes the problem starts again.

Finally I removed the keep alive * parameter in HTTP Request and the process is working smooth even at larger intervals.
Now I wonder as cURL is using keep alive as default, why is 4D failing when the time between two request is more than 4 minutes?
Any one seen a similar issue? Is this a bug? Should I bother about keep alive or not?

Thanks for any insights,


Keep-alive is not intended to maintain a connection which do nothing for several minutes but rather to send a multitude of requests without having to reopen a new connection for each of them.

In your case, you don’t seem to need keep-alive and it would be perfectly useless because the Server will probably have shut the connection down before sending the second request.

This said, your problem seems curious, I’ll try to reproduce it.


Hi Koen,

I have seen this often and I think it is a bug with 4D’s keep alive implementation. If the connection is no longer alive, 4D should just open a new one. But instead it generates error 17 as you indicated above. My solution was to just re-issue the request when that error is encountered. The web server in my case is 4D on a local network.

$status:=HTTP Request(HTTP POST method;$url;$request;$response;$aHdrName;$aHdrValue;*)
  Case of 
    : (Error=17)  //Hack for 4D keep alive bug - 17 = unimplemented control instruction.
      $status:=HTTP Request(HTTP POST method;$url;$request;$response;$aHdrName;$aHdrValue;*)
End case