[OpenSIPS-Users] Rest Client Async operation

SamyGo govoiper at gmail.com
Wed Jun 26 09:38:18 EDT 2019


Hi Liviu,

Is it possible to suspend the transaction and resume it once we somehow get
the event from libcurl as soon as the connect is done?
Im imagining the way usually APNS is done these days. The only thing
missing here is the event from the rest_client !

Can this mechanism help with the problem of backlog on the opensips thread
?

Best Regards,
Sammy


On Wed., Jun. 26, 2019, 9:23 a.m. Liviu Chircu, <liviu at opensips.org> wrote:

> 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 Developerhttp://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?
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190626/0066a0e7/attachment.html>


More information about the Users mailing list