[OpenSIPS-Users] Rest Client Async operation

Liviu Chircu liviu at opensips.org
Wed Jun 26 09:21:23 EDT 2019


It's the same process doing both the connect and the transfer.  The 
problem is that libcurl, as it stands now,
is not able to give me a file descriptor to poll on, until it connects 
[1].  See this section:

"When libcurl returns -1 in max_fd, it is because libcurl currently does 
something that isn't possible
for your application to monitor with a socket and unfortunately you can 
then not know exactly when the
current action is completed using select(). You then need to wait a 
while before you proceed and call
curl_multi_perform anyway. How long to wait? Unless curl_multi_timeout 
gives you a lower number, we
suggest 100 milliseconds or so, but you may want to test it out in your 
own particular conditions to
find a suitable value."

Regarding your issue: I would investigate further the reason why the 
connect is hanging, and not getting
rejected immediately when your server is down.  That would solve all 
your blocking issues.

The same with MySQL connections which go down: only after the connection 
is up are we able to obtain
its file descriptor to asynchronously poll on.  So if connect to 
DB_HOST:3306 hangs, so will OpenSIPS.

Regards,

[1]: https://curl.haxx.se/libcurl/c/curl_multi_fdset.html

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 25.06.2019 18:41, Ben Newlin wrote:
> but I guess my question would be why isn’t the entire operation run in 
> async? Why must the connect be performed in the current process and 
> only the transfer be in another process?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190626/7370642b/attachment.html>


More information about the Users mailing list