Skip to content
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

Fault tolerant repair. #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jkkj1630
Copy link

Cause i try to use NUTAG_APPL_METHOD("PRACK") to handle PRACK and 200OK for PRACK by application layer.
But sometime the network transmission is not satisfactory, the network problems caused sofia received 200ok for invite before receiving 200ok for prack.

And after handle 200OK for invite the nua_server_request_destroy function remove 200OK for INVITE from ds_sr list, then call su_free to release INVITE server request(nua_server.c:336) and the pointor sr0 will release and use to other new address, a new pointer will point to the freed memory,and maybe change the "sr_signal" pointer variable.

The "dr_sr" list only contains a request for prack, until 200 OK for prack arrives and processing at nua_prack_server_report, it will check the sr->sr_irq->irq_magic->sr_signal(nua_session.c:2986), and i know sr->sr_irq is equal to the previously released invite request sr, but at this time sofia don't know the sr->sr_irq is a released memory, maybe sr_signal is any number but not null ! It will call sr_signal at (nua_session.c:2989), the illegal memory address accessed.lead to all process to core dump.

I know this is a wrong order. 200ok for invite was received before 200ok for prack.So this is why i call it a fault tolerant repair.
I think we should check whether there are unprocessed requests before processing 200ok for invite. If there are, send 500 error.

@freeswitch-ci-system
Copy link

@jkkj1630
Copy link
Author

About my gdb backtrace info:
(gdb) backtrace
#0 0x00007ff7968ff889 in su_msg_data () from /usr/local/lib/libsofia-sip-ua.so.0
#1 0x00007ff7968947e3 in nua_event_data () from /usr/local/lib/libsofia-sip-ua.so.0
#2 0x00007ff79689487b in nua_signal_data () from /usr/local/lib/libsofia-sip-ua.so.0
#3 0x00007ff7968b5db6 in nua_prack_server_report () from /usr/local/lib/libsofia-sip-ua.so.0
#4 0x00007ff796898a70 in nua_server_report () from /usr/local/lib/libsofia-sip-ua.so.0
#5 0x00007ff796897bf0 in nua_stack_respond () from /usr/local/lib/libsofia-sip-ua.so.0
#6 0x00007ff796894706 in nua_stack_signal () from /usr/local/lib/libsofia-sip-ua.so.0
#7 0x00007ff796901b15 in su_base_port_execute_msgs () from /usr/local/lib/libsofia-sip-ua.so.0
#8 0x00007ff7969018a3 in su_base_port_getmsgs () from /usr/local/lib/libsofia-sip-ua.so.0
#9 0x00007ff796901c0a in su_base_port_run () from /usr/local/lib/libsofia-sip-ua.so.0
#10 0x00007ff7968fdf60 in su_port_run () from /usr/local/lib/libsofia-sip-ua.so.0
#11 0x00007ff7968ff03a in su_root_run () from /usr/local/lib/libsofia-sip-ua.so.0
#12 0x00007ff796902a6c in su_pthread_port_clone_main () from /usr/local/lib/libsofia-sip-ua.so.0
#13 0x00007ff795b32ea5 in start_thread () from /lib64/libpthread.so.0
#14 0x00007ff795186b0d in clone () from /lib64/libc.so.6
(gdb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant