Module: kamailio
Branch: master
Commit: 0b7b291ab153472c7d371c29e0c4dfa20c492f08
URL: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-27T09:08:08+01:00
snmpstats: init sigaction var and close fd in case of errors
---
Modified: src/modules/snmpstats/snmpstats.c
Modified: src/modules/snmpstats/sub_agent.c
---
Diff: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa…
Patch: https://github.com/kamailio/kamailio/commit/0b7b291ab153472c7d371c29e0c4dfa…
---
diff --git a/src/modules/snmpstats/snmpstats.c b/src/modules/snmpstats/snmpstats.c
index b2224ba47e..4bd11c98d2 100644
--- a/src/modules/snmpstats/snmpstats.c
+++ b/src/modules/snmpstats/snmpstats.c
@@ -539,6 +539,7 @@ static int spawn_sysUpTime_child(void)
LM_ERR("Ran out of memory while trying to retrieve sysUpTime. ");
LM_ERR(" kamailioSIPServiceStartTime is "
"defaulting to zero\n");
+ close(snmpget_fd);
return -1;
} else {
/* Make a new string containing the full path to the binary. */
@@ -559,6 +560,7 @@ static int spawn_sysUpTime_child(void)
/* We should never be able to get here, because execve() is never
* supposed to return. */
+ close(snmpget_fd);
free(full_path_to_snmpget);
exit(-1);
}
@@ -587,4 +589,4 @@ int set_snmp_community(modparam_t type, void *val)
snmp_community = (char *)val;
return 0;
-}
\ No newline at end of file
+}
diff --git a/src/modules/snmpstats/sub_agent.c b/src/modules/snmpstats/sub_agent.c
index fc938d0f2c..330a86128e 100644
--- a/src/modules/snmpstats/sub_agent.c
+++ b/src/modules/snmpstats/sub_agent.c
@@ -167,6 +167,7 @@ void agentx_child(int rank)
* need to be fatal however, because we can re-establish our
* connection. Therefore we set ourselves up to ignore the
* SIGPIPE. */
+ sigemptyset(&sigpipe_handler.sa_mask);
sigpipe_handler.sa_flags = SA_RESTART;
sigpipe_handler.sa_handler = SIG_IGN;
@@ -194,4 +195,4 @@ void register_with_master_agent(char *name_to_register_under)
/* Use a name we can register our agent under. */
init_snmp(name_to_register_under);
LM_DBG("** Connected to SNMPD MasterX\n");
-}
\ No newline at end of file
+}
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.
If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.
If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
When using http_async_client, I'm getting the following error:
Nov 28 08:18:49 tm-kamailio-ingress kamailio[24612]: 3(24635) : <core> [core/mem/q_malloc.c:483]: qm_free(): BUG: qm_free: freeing already freed pointer (0x7f62e75130c0), called from http_async_client: async_http.c: set_query_params(616), first free http_async_client: async_http.h: free_async_query(142) - aborting
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
route[REQUEST_PERMISSIONS] {
$var(body) = 0;
jansson_set("string", "from", "$fU", "$var(body)");
jansson_set("string", "to", "$tU", "$var(body)");
$http_req(all) = $null;
$http_req(method) = "POST";
$http_req(hdr) = "Content-Type: application/json";
$http_req(hdr) = "Accept: application/json";
$http_req(hdr) = "Connection: keep-alive";
$http_req(body) = $var(body);
$var(re_url)= "localhost:3000/v1/mock/makeCall";
if (http_async_query("$var(re_url)", "REQUEST_PERMISSIONS_REPLY") < 0) {
t_reply("500", "Server Internal Error");
exit;
}
}
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile
bt full
info locals
list
If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
```
(paste your debugging data here)
```
#### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
(paste your log messages here)
```
#### SIP Traffic
<!--
If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
(paste your sip traffic here)
```
### Possible Solutions
<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix.
-->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
(paste your output here)
```
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->
```
(paste your output here)
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1340
See <https://kamailio.sipwise.com/job/kamailio44-nightly-binaries/architecture=i…>
------------------------------------------
[...truncated 450.01 KB...]
CC (gcc) [M ims_usrloc_scscf.so] contact_dlg_handlers.o
CC (gcc) [M ims_usrloc_scscf.so] contact_hslot.o
CC (gcc) [M ims_usrloc_scscf.so] dlist.o
CC (gcc) [M ims_usrloc_scscf.so] hslot.o
CC (gcc) [M ims_usrloc_scscf.so] hslot_sp.o
CC (gcc) [M ims_usrloc_scscf.so] impurecord.o
impurecord.c:331: warning: 'rollback' defined but not used
impurecord.c: In function 'unlink_contact_from_impu':
impurecord.c:1103: warning: 'found_contact' may be used uninitialized in this function
CC (gcc) [M ims_usrloc_scscf.so] subscribe.o
CC (gcc) [M ims_usrloc_scscf.so] ucontact.o
ucontact.c: In function 'new_ucontact':
ucontact.c:85: warning: 'prev' may be used uninitialized in this function
CC (gcc) [M ims_usrloc_scscf.so] udomain.o
udomain.c: In function 'mem_timer_udomain':
udomain.c:282: warning: format '%lu' expects type 'long unsigned int', but argument 10 has type 'unsigned int'
udomain.c:282: warning: format '%lu' expects type 'long unsigned int', but argument 8 has type 'unsigned int'
CC (gcc) [M ims_usrloc_scscf.so] ul_callback.o
CC (gcc) [M ims_usrloc_scscf.so] ul_mod.o
CC (gcc) [M ims_usrloc_scscf.so] ul_rpc.o
CC (gcc) [M ims_usrloc_scscf.so] ul_scscf_stats.o
CC (gcc) [M ims_usrloc_scscf.so] usrloc.o
CC (gcc) [M ims_usrloc_scscf.so] usrloc_db.o
usrloc_db.c: In function 'db_insert_impurecord':
usrloc_db.c:149: warning: 'bin_str.len' may be used uninitialized in this function
usrloc_db.c:149: warning: 'bin_str.s' may be used uninitialized in this function
CC (gcc) [M ims_usrloc_scscf.so] utime.o
make[3]: `libkmi.so.1.0' is up to date.
make[3]: `libsrdb1.so.1.0' is up to date.
make[3]: `libkcore.so.1.0' is up to date.
LD (gcc) [M ims_usrloc_scscf.so] ims_usrloc_scscf.so
CC (gcc) [M ims_charging.so] Ro_data.o
CC (gcc) [M ims_charging.so] ccr.o
CC (gcc) [M ims_charging.so] dialog.o
CC (gcc) [M ims_charging.so] diameter_ro.o
CC (gcc) [M ims_charging.so] ims_charging_stats.o
CC (gcc) [M ims_charging.so] ims_ro.o
CC (gcc) [M ims_charging.so] mod.o
CC (gcc) [M ims_charging.so] ro_avp.o
CC (gcc) [M ims_charging.so] ro_db_handler.o
CC (gcc) [M ims_charging.so] ro_fixup.o
CC (gcc) [M ims_charging.so] ro_session_hash.o
CC (gcc) [M ims_charging.so] ro_timer.o
make[3]: `libkcore.so.1.0' is up to date.
make[3]: `libkamailio_ims.so.0.1' is up to date.
make[3]: `libsrdb1.so.1.0' is up to date.
LD (gcc) [M ims_charging.so] ims_charging.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="ktls"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M auth_identity.so] auth_crypt.o
CC (gcc) [M auth_identity.so] auth_dynstr.o
CC (gcc) [M auth_identity.so] auth_hdrs.o
CC (gcc) [M auth_identity.so] auth_http.o
CC (gcc) [M auth_identity.so] auth_identity.o
CC (gcc) [M auth_identity.so] auth_tables.o
LD (gcc) [M auth_identity.so] auth_identity.so
CC (gcc) [M crypto.so] crypto_mod.o
CC (gcc) [M crypto.so] crypto_uuid.o
LD (gcc) [M crypto.so] crypto.so
CC (gcc) [M tls.so] tls_bio.o
CC (gcc) [M tls.so] tls_cfg.o
CC (gcc) [M tls.so] tls_config.o
CC (gcc) [M tls.so] tls_ct_wrq.o
CC (gcc) [M tls.so] tls_domain.o
tls_domain.c:850: warning: 'tls_ssl_ctx_set_freelist' defined but not used
tls_domain.c:873: warning: 'tls_ssl_ctx_set_max_send_fragment' defined but not used
CC (gcc) [M tls.so] tls_dump_vf.o
CC (gcc) [M tls.so] tls_init.o
tls_init.c:100:3: warning: #warning "openssl < 1.0: no TLS extensions or server name support"
CC (gcc) [M tls.so] tls_locking.o
CC (gcc) [M tls.so] tls_mod.o
CC (gcc) [M tls.so] tls_rpc.o
CC (gcc) [M tls.so] tls_select.o
CC (gcc) [M tls.so] tls_server.o
CC (gcc) [M tls.so] tls_util.o
CC (gcc) [M tls.so] tls_verify.o
LD (gcc) [M tls.so] tls.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="koutbound"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M outbound.so] config.o
CC (gcc) [M outbound.so] ob_mod.o
make[3]: `libkcore.so.1.0' is up to date.
make[3]: `libkmi.so.1.0' is up to date.
LD (gcc) [M outbound.so] outbound.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="kwebsocket"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M websocket.so] config.o
CC (gcc) [M websocket.so] ws_conn.o
CC (gcc) [M websocket.so] ws_frame.o
CC (gcc) [M websocket.so] ws_handshake.o
CC (gcc) [M websocket.so] ws_mod.o
make[3]: `libkcore.so.1.0' is up to date.
make[3]: `libkmi.so.1.0' is up to date.
LD (gcc) [M websocket.so] websocket.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="kautheph"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M auth_ephemeral.so] autheph_mod.o
CC (gcc) [M auth_ephemeral.so] authorize.o
CC (gcc) [M auth_ephemeral.so] checks.o
make[3]: `libkcore.so.1.0' is up to date.
make[3]: `libkmi.so.1.0' is up to date.
LD (gcc) [M auth_ephemeral.so] auth_ephemeral.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="kerlang"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M erlang.so] cnode.o
cnode.c: In function 'cnode_connect_to':
cnode.c:109: warning: dereferencing pointer 'addr.830' does break strict-aliasing rules
cnode.c:109: note: initialized from here
CC (gcc) [M erlang.so] epmd.o
epmd.c: In function 'handle_epmd':
epmd.c:99: warning: dereferencing pointer 'paddr.469' does break strict-aliasing rules
epmd.c:99: note: initialized from here
CC (gcc) [M erlang.so] erl_api.o
CC (gcc) [M erlang.so] erl_helpers.o
CC (gcc) [M erlang.so] handle_emsg.o
CC (gcc) [M erlang.so] handle_rpc.o
CC (gcc) [M erlang.so] mod_erlang.o
mod_erlang.c: In function 'erl_rpc':
mod_erlang.c:446: warning: 'pvn' may be used uninitialized in this function
CC (gcc) [M erlang.so] pv_atom.o
CC (gcc) [M erlang.so] pv_list.o
CC (gcc) [M erlang.so] pv_pid.o
CC (gcc) [M erlang.so] pv_ref.o
CC (gcc) [M erlang.so] pv_tuple.o
CC (gcc) [M erlang.so] pv_xbuff.o
CC (gcc) [M erlang.so] worker.o
make[3]: `libkcore.so.1.0' is up to date.
LD (gcc) [M erlang.so] erlang.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
# package all the modules in EXTRA_GROUPS in separate packages
/usr/bin/make every-module group_include="kgzcompress"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M gzcompress.so] gzcompress_mod.o
LD (gcc) [M gzcompress.so] gzcompress.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="kuuid"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M uuid.so] uuid_mod.o
uuid_mod.c: In function 'pv_get_uuid':
uuid_mod.c:167: warning: implicit declaration of function 'uuid_generate_time_safe'
LD (gcc) [M uuid.so] uuid.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="kev"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M evapi.so] evapi_dispatch.o
evapi_dispatch.c: In function 'evapi_recv_client':
evapi_dispatch.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 13 has type 'ssize_t'
evapi_dispatch.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 11 has type 'ssize_t'
evapi_dispatch.c: In function 'evapi_run_dispatcher':
evapi_dispatch.c:570: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:570: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:570: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:572: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:572: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:572: warning: dereferencing type-punned pointer will break strict-aliasing rules
evapi_dispatch.c:570: warning: dereferencing pointer 'io_server.720' does break strict-aliasing rules
evapi_dispatch.c:570: warning: dereferencing pointer 'io_server.720' does break strict-aliasing rules
evapi_dispatch.c:570: warning: dereferencing pointer 'io_server.720' does break strict-aliasing rules
evapi_dispatch.c:570: note: initialized from here
evapi_dispatch.c:570: warning: dereferencing pointer 'io_server.720' does break strict-aliasing rules
evapi_dispatch.c:570: note: initialized from here
evapi_dispatch.c:572: warning: dereferencing pointer 'io_notify.721' does break strict-aliasing rules
evapi_dispatch.c:572: warning: dereferencing pointer 'io_notify.721' does break strict-aliasing rules
evapi_dispatch.c:572: warning: dereferencing pointer 'io_notify.721' does break strict-aliasing rules
evapi_dispatch.c:572: note: initialized from here
evapi_dispatch.c:572: warning: dereferencing pointer 'io_notify.721' does break strict-aliasing rules
evapi_dispatch.c:572: note: initialized from here
evapi_dispatch.c: In function 'evapi_accept_client':
evapi_dispatch.c:431: warning: dereferencing pointer 'caddr.634' does break strict-aliasing rules
evapi_dispatch.c:431: note: initialized from here
CC (gcc) [M evapi.so] evapi_mod.o
make[3]: `libsrutils.so.1.0' is up to date.
make[3]: `libkcore.so.1.0' is up to date.
LD (gcc) [M evapi.so] evapi.so
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
/usr/bin/make every-module group_include="khttp_async"
make[1]: Entering directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
CC (gcc) [M http_async_client.so] async_http.o
async_http.c:42:26: warning: event2/event.h: No such file or directory
async_http.c: In function 'async_http_init_worker':
async_http.c:67: warning: implicit declaration of function 'event_base_new'
async_http.c:67: warning: assignment makes pointer from integer without a cast
async_http.c: In function 'async_http_run_worker':
async_http.c:84: warning: implicit declaration of function 'event_base_dispatch'
async_http.c: In function 'init_socket':
async_http.c:319: warning: implicit declaration of function 'event_new'
async_http.c:319: error: 'EV_READ' undeclared (first use in this function)
async_http.c:319: error: (Each undeclared identifier is reported only once
async_http.c:319: error: for each function it appears in.)
async_http.c:319: error: 'EV_PERSIST' undeclared (first use in this function)
async_http.c:320: warning: implicit declaration of function 'event_add'
make[2]: *** [async_http.o] Error 1
make[1]: *** [modules] Error 1
make[1]: Leaving directory `/tmp/buildd/kamailio-4.4.6+0~20171222011415.125+squeeze'
make: *** [build-stamp] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: user script /var/cache/pbuilder/build/cow.12736/tmp/hooks/C10shell starting
┌──────────────────────────────────────────────────────────────────────────────┐
│ FTBFS - problem with building Debian package │
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│ DEB_KEEP_BUILD_ENV is not set to 'true', not keeping build environment │
└──────────────────────────────────────────────────────────────────────────────┘
I: user script /var/cache/pbuilder/build/cow.12736/tmp/hooks/C10shell finished
I: unmounting /tmp/apt-jdg_mhqfXP filesystem
I: unmounting dev/pts filesystem
I: unmounting run/shm filesystem
I: unmounting proc filesystem
-> Cleaning COW directory
forking: rm -rf /var/cache/pbuilder/build//cow.12736
+ '[' 1 -eq 0 ']'
+ bailout 1 'Error: Failed to build with cowbuilder.'
+ '[' -n 1 ']'
+ EXIT=1
+ '[' -n 'Error: Failed to build with cowbuilder.' ']'
+ echo 'Error: Failed to build with cowbuilder.'
Error: Failed to build with cowbuilder.
+ rm -f /var/run/lock/squeeze-i386.building.6909
+ '[' -r /var/run/lock/squeeze-i386.update.6909 ']'
+ '[' '' = true ']'
+ echo '*** Getting rid of files in <https://kamailio.sipwise.com/job/kamailio44-nightly-binaries/architecture=i…> to avoid problems in next run. ***'
*** Getting rid of files in <https://kamailio.sipwise.com/job/kamailio44-nightly-binaries/architecture=i…> to avoid problems in next run. ***
+ rm -f '<https://kamailio.sipwise.com/job/kamailio44-nightly-binaries/architecture=i…'>
+ '[' -n /tmp/tmp.lZ1znVtP3R ']'
+ rm -rf /tmp/tmp.lZ1znVtP3R
+ '[' -n /tmp/apt-jdg_mhqfXP ']'
+ sudo rm -rf /tmp/apt-jdg_mhqfXP
+ '[' -n 9624 ']'
++ sed -e 's/^\([0-9]*\).*/\1/'
+ SECONDS=610
++ date
+ echo '*** Finished execution of /usr/bin/build-and-provide-package at Fri Dec 22 04:35:57 UTC 2017 [running 610 seconds] ***'
*** Finished execution of /usr/bin/build-and-provide-package at Fri Dec 22 04:35:57 UTC 2017 [running 610 seconds] ***
+ exit 1
Build step 'Execute shell' marked build as failure
Archiving artifacts
Recording fingerprints
TAP Reports Processing: START
Looking for TAP results report in workspace using pattern: report/*.tap
Did not find any matching files.
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?