[sr-dev] [kamailio/kamailio] erlang: getting null value in erl_xbuff in response of erl_rpc request (#2069)

vipulpatel310 notifications at github.com
Thu Sep 19 09:28:22 CEST 2019


### Description
**I did:**
I have installed kamailio 5.2.4 in ubuntu system and configured kamailio script to connect with erlang node also it sends rpc request to erlang node and get response which I have printed in a logs.
...
 $erl_list(L) = "two";
 $erl_list(L) = "one";
 xlog("L_ALERT","Before RPC: $erl_list(args=>format)\n");
 erl_rpc("erlang", "list_to_tuple", "$erl_list(args)", "$erl_xbuff(repl)");
 xlogl("L_ALERT","type(reply): $erl_xbuff(repl=>type), format(repl): $erl_xbuff(repl=>format)\n");
...

**Expected to happen:**
Response should be get from erlang node against RPC request and it should be store in erl_xbuff. And it should be print logs like: ALERT: <script>: 501:type(reply): tuple, format(repl): {"one", "two"}

**Actually happened:**
Response is getting properly. but the problem is to store data into xbuff so it print logs like: ALERT: <script>: 501:type(reply): <null>, format(repl): <null>

### Troubleshooting
I have check with older version 4.3.0 and it works fine. getting this problem after 5.2.0 version
So, I have compare 5.2.0 and 4.3.0 version code. I found one change in pv_xbuff.c file which is creating a problem when I revert the change then it works fine.

#### Reproduction
It will be reproducible everytime. Just sends rpc request and get the value in xbuff. check xbuff value

#### Log Messages
Problem logs:
```
ALERT: <script>: Before RPC: [["one", "two"]]
WARNING: <core> [core/mem/q_malloc.c:480]: qm_free(): WARNING: free(0) called from erlang: pv_xbuff.c: xavp_decode(1209)
ALERT: <script>: 501:type(reply): <null>, format(repl): <null>
```
logs after change:
```
ALERT: <script>: Before RPC: [["one", "two"]]
WARNING: <core> [core/mem/q_malloc.c:480]: qm_free(): WARNING: free(0) called from erlang: pv_xbuff.c: xavp_decode(1209)
ALERT: <script>: 501:type(reply): tuple, format(repl): {"one", "two"}
```

### Possible Solutions
revert the 6542a367638ec5f8a2b62994f8c309e7a2533962 commit. It will work fine

### Additional Information

```
version: kamailio 5.2.4 (x86_64/linux) 759867
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 759867 
compiled on 11:52:55 Sep  4 2019 with gcc 7.4.0

```

* **Operating System**:
```
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic

Linux hostname.domain.com 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2069
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190919/720d4d32/attachment.html>


More information about the sr-dev mailing list