OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.28k stars 581 forks source link

[BUG] rest_client module: sometimes does not process the response, gives an error on timeout #2105

Open olegans1972 opened 4 years ago

olegans1972 commented 4 years ago

OpenSIPS version you are running

[xxx@nwspx-1~]$ opensips -V version: opensips 3.0.2 (x86_64/linux) flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535 poll method support: poll, epoll, sigio_rt, select. git revision: cffc724 main.c compiled on 11:44:31 Apr 22 2020 with gcc 4.8.5

Describe the bug

I set the following parameter:

loadmodule "rest_client.so" modparam("rest_client", "curl_timeout", 1) modparam("rest_client", "connection_timeout", 1)

Opensips gets INVITE. Based on it, using rest_client generates an
asynchronously HTTP request to the external server. After 2 milliseconds receives a response (I see it at the tcpdump). But after 2 seconds, opensips sends a 500 message with a -3 error.

The load is not large, about 10-15 requests per second. This behavior does not occur with every request. There are few such errors, but they are. For 2 and a half hours of work in the logs there were 11 such errors.

May 7 23:31:24 nw-spx-1 /usr/sbin/opensips[13836]: ERROR:rest_client:resume_async_http_req: connected, but transfer timed out (1s)

To Reproduce

Expected behavior

There is a response from the http server. Why opensips sometimes ignores it?

Relevant System Logs

May 7 23:31:24 nw-spx-1 /usr/sbin/opensips[13836]: ERROR:rest_client:resume_async_http_req: connected, but transfer timed out (1s)

OS/environment information

Additional context

curl_timeout_1_sec.zip

liviuchircu commented 4 years ago

@olegans1972 what kind of report is this? Please add the required details, otherwise I'm going to have to close it...

olegans1972 commented 4 years ago

Hi @liviuchircu!

I apologize, as always, with bugs that are difficult to reproduce. But they are on the system. I would like to attach a small call dump. curl_timeout_1_sec.zip

stale[bot] commented 4 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

olegans1972 commented 4 years ago

If I transfer the rest client to synchronous mode, then I do not see such accidents

liviuchircu commented 4 years ago

hey, @olegans1972 - since this looks like a timing bug, I will try do add some variable delay into the async REST POST replies from the web server and see if I get rest_client to misbehave.

stale[bot] commented 4 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

stale[bot] commented 4 years ago

Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details.