-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CRASH] OpenSIPS segfaults during startup #3359
Comments
@NormB , if you go to frame 1 and print the
I suspect the api structure (with pointers to functions) provided by the clustering module is not valid populated .... Like the clusterer module was not loaded by presence module |
The following docker-compose.yml updates seem to help get core dumps created (still starting as user/group root, not user/group opensips) :(
|
bt full
|
|
Tested with cluster_id being set and fallback2db, cluster_federation_mode still commented. Same segfault with pres_cluster_id = 0.
|
Uncommenting cluster_federation_mode --> no segfault |
subscriber.c
It looks like shtag_get() does not perform a check of the cluster_id value before calling shtag_get_unsafe(). Perhaps a test for cluster_id <= 0 and a then a negative return (before any locking is performed) should be done. More importantly, the cluster_id is set as a global parameter so it's unclear why it's 0 in the core.
|
Tested adding a return -1 to shtag_get() if the cluster_id <= 0. The same segfault happened, so perhaps I didn't install the test patch correctly. Otherwise, the root of the problem is somewhere else. |
Avoid evaluating sharing tags when the clustering support in presence module is disabled. Related to #3359
@NormB , if the Now, your original crash is most probably related to the fact that you have the clustering support disabled in the presence module (by not setting the |
Confirmed that the fix works correctly. Thank you. |
OpenSIPS version you are running
Crash Core Dump
I've tried enabling all the recommended settings in the docker container to generate a core dump, however OpenSIPS still isn't able to generate one. Maybe there is something missing in docker-compose.yml or entrypoint.sh.
Running OpenSIPS as user/group = root/root allowed for the creation of the core dump.
docker-compose.yml
entrypoint.sh
Describe the traffic that generated the bug
It looks like the segfault happens while processing a SUBSCRIBE request
To Reproduce
When the commented lines in the presence module are not commented, the segfault does not happen.
loadmodule "presence.so"
modparam("presence", "db_url", "{DB_TYPE}://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}")
#modparam("presence", "fallback2db", 1)
#modparam("presence", "cluster_id", {PRESENCE_CLUSTER_ID})
modparam("presence", "mix_dialog_presence", 1)
#modparam("presence", "cluster_federation_mode", "full-sharing")
modparam("presence", "contact_user", "presence")
modparam("presence", "end_sub_on_timeout", 1)
modparam("presence", "notify_offline_body", 1)
modparam("presence", "clean_period", 30)
modparam("presence", "db_update_period", 5)
Relevant System Logs
backtrace
Changed the calls to handle_subscribe() and the segfaults have stopped.
OS/environment information
debian:bookworm
Additional context
The text was updated successfully, but these errors were encountered: