<h3>Description</h3>
<p><strong>I did:</strong><br>
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.<br>
...<br>
$erl_list(L) = "two";<br>
$erl_list(L) = "one";<br>
xlog("L_ALERT","Before RPC: $erl_list(args=>format)\n");<br>
erl_rpc("erlang", "list_to_tuple", "$erl_list(args)", "$erl_xbuff(repl)");<br>
xlogl("L_ALERT","type(reply): $erl_xbuff(repl=>type), format(repl): $erl_xbuff(repl=>format)\n");<br>
...</p>
<p><strong>Expected to happen:</strong><br>
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"}</p>
<p><strong>Actually happened:</strong><br>
Response is getting properly. but the problem is to store data into xbuff so it print logs like: ALERT: <script>: 501:type(reply): , format(repl): </p>
<h3>Troubleshooting</h3>
<p>I have check with older version 4.3.0 and it works fine. getting this problem after 5.2.0 version<br>
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.</p>
<h4>Reproduction</h4>
<p>It will be reproducible everytime. Just sends rpc request and get the value in xbuff. check xbuff value</p>
<h4>Log Messages</h4>
<p>Problem logs:</p>
<pre><code>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>
</code></pre>
<p>logs after change:</p>
<pre><code>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"}
</code></pre>
<h3>Possible Solutions</h3>
<p>revert the <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kamailio/kamailio/commit/6542a367638ec5f8a2b62994f8c309e7a2533962/hovercard" href="https://github.com/kamailio/kamailio/commit/6542a367638ec5f8a2b62994f8c309e7a2533962"><tt>6542a36</tt></a> commit. It will work fine</p>
<h3>Additional Information</h3>
<pre><code>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

</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2069?email_source=notifications&email_token=ABO7UZJGAWWZLQ3BIRLX5IDQKMSZNA5CNFSM4IYHOTR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HMKTHHQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZP3A76SWC2IDRQBOMTQKMSZNANCNFSM4IYHOTRQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZOFGZYK6ALXW3I32Q3QKMSZNA5CNFSM4IYHOTR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HMKTHHQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2069?email_source=notifications\u0026email_token=ABO7UZJGAWWZLQ3BIRLX5IDQKMSZNA5CNFSM4IYHOTR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HMKTHHQ",
"url": "https://github.com/kamailio/kamailio/issues/2069?email_source=notifications\u0026email_token=ABO7UZJGAWWZLQ3BIRLX5IDQKMSZNA5CNFSM4IYHOTR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HMKTHHQ",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>