<p></p>
<p>In my opinion there are issues of concurrency in writing to the file. It seems to be open in the main process, during the initialisation and then write to it during runtime from kamailio processes. Writing from multiple processes to the same file is going to have unpredictable content.</p>
<p>The solution would be to either have a lock around and do every time: lock, open file, write, close unlock; or create a consumer process that write to the file and the others produce data that is sent to it. Another option would be that each process writes to dedicated file (e.g., filename-pid).</p>
<p>I also noticed that the file name is reallocated in pkg using a local variable in a function and not freed.</p>

<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/pull/2785#issuecomment-869404475">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIRTWOALDM2YHO3ZITTVAKSRANCNFSM47BQRZIA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPJRV3GB2GU4HW6KP3TVAKSRA5CNFSM47BQRZIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGPJA6OY.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/pull/2785#issuecomment-869404475",
"url": "https://github.com/kamailio/kamailio/pull/2785#issuecomment-869404475",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>