OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.26k stars 577 forks source link

[CRASH] msg_translator.c: len mismatch : calculated 1096, written 1397 #1939

Closed lemenkov closed 4 years ago

lemenkov commented 4 years ago

Hello All, I've just got hit by this strange message followed by abort() call (see msg_translator.c:2323).

I am testing a custom opensips module but I still cannot find a clue on how it can affect it. I am using opensips b660a21e1dfc2af4ae44fa752fb18c598d8e5cf8 as a master for my development.

Several invites are passing OK but after a 20-40 ones it fails.

Here is a coredump:

https://send.firefox.com/download/3db383781e7a099a/#kOKTGDPNgTeGeQk6ES0zIQ

Apparently lumps_len(...) gives us a different size than one calculated during apply_msg_changes(...) function.

razvancrainea commented 4 years ago

Could you please tell us the OS you are using?

razvancrainea commented 4 years ago

Also, is OpenSIPS installed from sources? If so, what are the compile flags you used?

lemenkov commented 4 years ago

Could you please tell us the OS you are using?

Linux, Ubuntu 18.04.3 LTS.

Also, is OpenSIPS installed from sources? If so, what are the compile flags you used?

Nothing really fancy. Default ones I guess

gcc -g -O0 -funroll-loops -Wcast-align -Wall -minline-all-stringops -falign-loops -ftree-vectorize -mtune=nocona -Wold-style-definition -Wmissing-field-initializers -Wredundant-decls   -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC  -DQ_MALLOC  -DHP_MALLOC  -DDBG_MALLOC  -DCC_O0   -DNAME='"opensips"' -DVERSION='"3.1.0-dev"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 7"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/usr/local//etc/opensips/"'  -DVERSIONTYPE='"git"' -DTHISREVISION='"9b767b929"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -c msg_translator.c -o msg_translator.o
Linking opensips
gcc  -Wl,-O2 -Wl,-E   blacklists.o cmds.o sr_module_deps.o context.o ipc.o ut.o data_lump.o bin_interface.o msg_translator.o msg_callbacks.o pt_scaling.o qvalue.o async.o map.o crc.o error.o script_cb.o dprint.o io_wait.o modparam.o core_cmds.o tsend.o pt.o receive.o proxy.o core_stats.o socket_info.o md5utils.o pt_load.o action.o sha1.o flags.o cfg_pp.o sl_cb.o reactor.o forward.o daemonize.o time_rec.o data_lump_rpl.o xlog.o serialize.o mod_fix.o route_struct.o regexp.o route.o md5.o trace_api.o timer.o transformations.o resolve.o name_alias.o ip_addr.o statistics.o usr_avp.o errinfo.o main.o strcommon.o sr_module.o script_var.o dset.o pvar.o cfg_reload.o re.o prime_hash.o mem/mem.o mem/rpm_mem.o mem/common.o mem/q_malloc.o mem/hp_malloc_stats.o mem/mem_dbg_hash.o mem/module_info.o mem/f_malloc.o mem/memtest.o mem/shm_mem.o mem/hp_malloc.o aaa/aaa.o parser/parse_sst.o parser/parse_uri.o parser/parse_disposition.o parser/parse_param.o parser/parse_replaces.o parser/parse_list_hdr.o parser/parse_rpid.o parser/parse_fline.o parser/parse_from.o parser/parser_f.o parser/parse_rr.o parser/parse_refer_to.o parser/parse_pai.o parser/parse_call_info.o parser/parse_cseq.o parser/parse_content.o parser/parse_sipifmatch.o parser/parse_nameaddr.o parser/parse_hname2.o parser/hf.o parser/msg_parser.o parser/parse_ppi.o parser/parse_event.o parser/parse_via.o parser/parse_min_expires.o parser/parse_body.o parser/parse_expires.o parser/parse_privacy.o parser/parse_allow.o parser/parse_authenticate.o parser/parse_diversion.o parser/parse_methods.o parser/parse_to.o parser/parse_supported.o lib/path.o lib/sliblist.o lib/url.o lib/csv.o lib/cJSON.o parser/digest/param_parser.o parser/digest/digest_parser.o parser/digest/digest.o parser/sdp/sdp.o parser/sdp/sdp_helpr_funcs.o parser/contact/contact.o parser/contact/parse_contact.o db/db_query.o db/db_id.o db/db_row.o db/db_insertq.o db/db_res.o db/db.o db/db_pool.o db/db_async.o db/db_ut.o mi/mi_trace.o mi/mi.o mi/mi_core.o mi/item.o mi/fmt.o evi/evi_transport.o evi/event_interface.o evi/evi_params.o evi/evi_core.o cachedb/cachedb_dict.o cachedb/cachedb_pool.o cachedb/cachedb_types.o cachedb/cachedb_id.o cachedb/cachedb.o net/net_udp.o net/trans.o net/net_tcp_proc.o net/net_tcp.o net/tcp_passfd.o net/net_tcp_report.o net/trans_trace.o net/proto_tcp/proto_tcp.o net/proto_udp/proto_udp.o lex.yy.o cfg.tab.o  -ldl -lresolv -pthread -rdynamic -ldl -Wl,-Bsymbolic-functions -o opensips
razvancrainea commented 4 years ago

Since the code has been installed from sources, it will be harder for me to inspect the core dump. Could you run gdb on your core file and send the bt full output?

lemenkov commented 4 years ago

Here is the full bd (with real IPs changes to the IPs of the same size but from RFC1918 networks)

https://paste.centos.org/view/87f5fdac

razvancrainea commented 4 years ago

I see that you are using branch_route and most likely you are doing some append_hf in there, correct? If so, is there any other operations that you are doing in branch route?

stale[bot] commented 4 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

lemenkov commented 4 years ago

There was an issue made by me during my attempts to fix another one issue so going to close this one. Sorry for the noise.