Description

We are facing a hang issue with Kamailio for the get_profile_size method. Randomly, the Kamailio got hangs, and the CPU went 100%.
During the hanging time, we generated the TRAP and we could see that the hang happened on the get_profile_size method. We are getting this hang randomly in dlg_profile.c of the following lines:

The hang occurs, causing the CPU to spike to 100% at one of the following lines randomly:

  1. if(value->len == ph->value.len && memcmp(value->s, ph->value.s, value->len) == 0) {
  2. ph = ph->next;
  3. while(ph != profile->entries[i].first);

During our analysis, we found that PROCESS ID 7608 gets a spike of 100% utilization.

We suspect there may be an issue with the processing of the 'ph' variable, but we couldn't identify the root cause. I've attached the Kamailio TRAP for further details. Could you please suggest what might be causing this problem and how we can resolve it?

Troubleshooting

We have analysed the coredump and TRAP, And found that the issue could be from the following lines:

  1. if(value->len == ph->value.len && memcmp(value->s, ph->value.s, value->len) == 0) {
  2. ph = ph->next;
  3. while(ph != profile->entries[i].first);

Reproduction

This issue is occurring randomly.

Debugging Data

I have attached the TRAP data.

---start 7608 -----------------------------------------------------
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
get_profile_size (profile=0x7f7095698f50, value=0x7ffd5e21db20) at dlg_profile.c:860
860 }while( ph!=profile->entries[i].first );
#0 get_profile_size (profile=0x7f7095698f50, value=0x7ffd5e21db20) at dlg_profile.c:860
n = 0
i = 9
ph = 0x7f70958d3c98
#1 0x00007f7195585785 in w_get_profile_size_helper (msg=0x7f7198418558, profile=0x7f7095698f50, value=0x7ffd5e21db20, spd=0x7f71983a8cf0) at dialog.c:941
size = 32625
val = {rs = {s = 0x7ffd5e21da80 "\260\332!^\375\177", len = 591976160}, ri = xxxxxxxx77096, flags = 32765}
func = "w_get_profile_size_helper"
#2 0x00007f7195585fd2 in w_get_profile_size3 (msg=0x7f7198418558, profile=0x7f7095698f50 "\200\220i\225p\177", value=0x7f71983b4b30 "80;\230q\177", result=0x7f71983a8cf0 "\004") at dialog.c:982
pve = 0x7f71983b4b30
val_s = {s = 0x7f7198346dd0 "2777995", len = 7}
spd = 0x7f71983a8cf0
func = "w_get_profile_size3"

Log Messages

When Kamailio hangs, the logs are not written to the kamailio.log file.

SIP Traffic

I have attached the TRAP file.

Possible Solutions

We are expecting some kind of solution for it.

Additional Information

kamailio version is 5.5.5```

* **Operating System**:
[gdb_kamailio_trap.zip](https://github.com/user-attachments/files/16581474/gdb_kamailio_trap.zip)

"Debian GNU/Linux 10 (buster)"```


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3947@github.com>