[OpenSIPS-Devel] [opensips] Async http replies randomly missed (#493)

Dan Christian Bogos notifications at github.com
Sat May 2 22:25:19 CEST 2015


Hey Guys,

Running on commit 59d7d48291c789d68cd88f7fc5e7c7db674f0ce3, branch 2.1, I hit a weird inconsistency in handling the replies to async http_post (using rest_client).

Having this code snippet(cgr_auth is a json variable but not sure that matters much in terms of processing reply, just showing it here to figure out where the log comes from):
`
route[CGR_AUTH] {
...
xlog("$json(cgr_auth)"); 
async(rest_post("http://127.0.0.1:2080/jsonrpc", "$json(cgr_auth)", "application/json", "$json(cgr_auth_reply)", "$var(ct)", "$var(rcode)"), CGR_AUTH_REPLY);
}
route[CGR_AUTH_REPLY] {
	xlog("In CGR_AUTH_REPLY, reply received: $json(cgr_auth_reply)");
...
}
`
I am capturing syslog and ngrep in the same screen and getting the following output (which shows that first reply is missed, second is luckily processed, but not a pattern since sometimes I miss 6 replies in a row - please see timestamps):

`
root at OsipsDev1:~/cgrates# May  2 22:21:32 OsipsDev1 /usr/sbin/opensips[27197]: { "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }
####
T 2015/05/02 22:21:32.881899 127.0.0.1:38528 -> 127.0.0.1:2080 [AP]
POST /jsonrpc HTTP/1.1.
Host: 127.0.0.1:2080.
Accept: */*.
Content-Type: application/json.
Content-Length: 112.
.
{ "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }
##
T 2015/05/02 22:21:32.882474 127.0.0.1:2080 -> 127.0.0.1:38528 [AP]
HTTP/1.1 200 OK.
Content-Type: application/json.
Date: Sat, 02 May 2015 20:21:32 GMT.
Content-Length: 36.
.
{"id":"1","result":-1,"error":null}

#May  2 22:21:54 OsipsDev1 /usr/sbin/opensips[27197]: ERROR:rest_client:start_async_http_req: timeout while connecting to 'http://127.0.0.1:2080/jsonrpc' (20 sec)
May  2 22:21:54 OsipsDev1 /usr/sbin/opensips[27197]: In CGR_AUTH_REPLY, reply received: <null>
#
T 2015/05/02 22:22:05.261449 127.0.0.1:38528 -> 127.0.0.1:2080 [AP]
POST /jsonrpc HTTP/1.1.
Host: 127.0.0.1:2080.
Accept: */*.
Content-Type: application/json.
Content-Length: 112.
.
{ "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }
May  2 22:22:05 OsipsDev1 /usr/sbin/opensips[27197]: { "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }
#
T 2015/05/02 22:22:05.262231 127.0.0.1:2080 -> 127.0.0.1:38528 [AP]
HTTP/1.1 200 OK.
Content-Type: application/json.
Date: Sat, 02 May 2015 20:22:05 GMT.
Content-Length: 36.
.
{"id":"1","result":-1,"error":null}

#May  2 22:22:05 OsipsDev1 /usr/sbin/opensips[27197]: In CGR_AUTH_REPLY, reply received: {"id":"1","result":-1,"error":null}
`

Thanks in advance for any kind of tip.

DanB



---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/493
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150502/03bcee62/attachment.htm>


More information about the Devel mailing list