restconf fcgi mem leak in indata
test pkill needs sleep before name settles
This commit is contained in:
parent
df05acdc9e
commit
3539a80d5e
6 changed files with 19 additions and 10 deletions
|
|
@ -220,8 +220,11 @@ restconf_reply_send(void *req0,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! Get input data from http request, eg such as curl -X PUT http://... <indata>
|
||||||
* @param[in] req Fastcgi request handle
|
* @param[in] req Fastcgi request handle
|
||||||
|
* @retval indata
|
||||||
|
* @retval NULL Error
|
||||||
|
* @note: creates a new cbuf which differs from native api where a pointer is returned
|
||||||
*/
|
*/
|
||||||
cbuf *
|
cbuf *
|
||||||
restconf_get_indata(void *req0)
|
restconf_get_indata(void *req0)
|
||||||
|
|
|
||||||
|
|
@ -172,9 +172,9 @@ restconf_reply_send(void *req0,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! get input data
|
/*! Get input data from http request, eg such as curl -X PUT http://... <indata>
|
||||||
* @param[in] req Fastcgi request handle
|
* @param[in] req Request handle
|
||||||
* @note Pulls up an event buffer and then copies it to a cbuf. This is not efficient.
|
* @note: reuses cbuf from stream-data
|
||||||
*/
|
*/
|
||||||
cbuf *
|
cbuf *
|
||||||
restconf_get_indata(void *req0)
|
restconf_get_indata(void *req0)
|
||||||
|
|
|
||||||
|
|
@ -588,6 +588,10 @@ api_root_restconf(clicon_handle h,
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||||
|
#ifdef WITH_RESTCONF_FCGI
|
||||||
|
if (cb)
|
||||||
|
cbuf_free(cb);
|
||||||
|
#endif
|
||||||
if (xerr)
|
if (xerr)
|
||||||
xml_free(xerr);
|
xml_free(xerr);
|
||||||
if (username)
|
if (username)
|
||||||
|
|
|
||||||
|
|
@ -648,7 +648,7 @@ clixon_process_operation(clicon_handle h,
|
||||||
sched++;/* start: immediate stop/restart: not immediate: wait timeout */
|
sched++;/* start: immediate stop/restart: not immediate: wait timeout */
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
clicon_debug(1, "%s name:%s op %s cancelled by wrwap", __FUNCTION__, name, clicon_int2str(proc_operation_map, op0));
|
clicon_debug(1, "%s name:%s op %s cancelled by wrap", __FUNCTION__, name, clicon_int2str(proc_operation_map, op0));
|
||||||
}
|
}
|
||||||
break; /* hit break here */
|
break; /* hit break here */
|
||||||
}
|
}
|
||||||
|
|
@ -688,6 +688,7 @@ clixon_process_status(clicon_handle h,
|
||||||
pe = _proc_entry_list;
|
pe = _proc_entry_list;
|
||||||
do {
|
do {
|
||||||
if (strcmp(pe->pe_name, name) == 0){
|
if (strcmp(pe->pe_name, name) == 0){
|
||||||
|
clicon_debug(1, "%s found %s pid:%d", __FUNCTION__, name, pe->pe_pid);
|
||||||
/* Check if running */
|
/* Check if running */
|
||||||
run = 0;
|
run = 0;
|
||||||
if (pe->pe_pid && proc_op_run(pe->pe_pid, &run) < 0)
|
if (pe->pe_pid && proc_op_run(pe->pe_pid, &run) < 0)
|
||||||
|
|
|
||||||
|
|
@ -382,9 +382,10 @@ function stop_restconf_pre(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop restconf daemon after test
|
# Stop restconf daemon after test
|
||||||
# Two caveats in pkill:
|
# Some problems with pkill:
|
||||||
# 1) Dont use $clixon_restconf (dont work in valgrind)
|
# 1) Dont use $clixon_restconf (dont work in valgrind)
|
||||||
# 2) Dont use -u $WWWUSER since clixon_restconf may drop privileges.
|
# 2) Dont use -u $WWWUSER since clixon_restconf may drop privileges.
|
||||||
|
# 3) After fork, it seems to take some time before name is right
|
||||||
function stop_restconf(){
|
function stop_restconf(){
|
||||||
sudo pkill -f clixon_restconf
|
sudo pkill -f clixon_restconf
|
||||||
if [ $valgrindtest -eq 3 ]; then
|
if [ $valgrindtest -eq 3 ]; then
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ cat<<EOF > $startupdb
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
new "kill old restconf"
|
new "kill old restconf"
|
||||||
|
sleep $DEMSLEEP
|
||||||
stop_restconf_pre
|
stop_restconf_pre
|
||||||
|
|
||||||
new "test params: -f $cfg"
|
new "test params: -f $cfg"
|
||||||
|
|
@ -276,9 +277,8 @@ if [ $pid0 -eq $pid3 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill restconf using kill"
|
new "kill restconf using kill"
|
||||||
stop_restconf_pre
|
|
||||||
|
|
||||||
sleep $DEMSLEEP
|
sleep $DEMSLEEP
|
||||||
|
stop_restconf_pre
|
||||||
|
|
||||||
new "Wait for restconf to stop"
|
new "Wait for restconf to stop"
|
||||||
wait_restconf_stopped
|
wait_restconf_stopped
|
||||||
|
|
@ -378,6 +378,7 @@ cat<<EOF > $startupdb
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
new "kill old restconf"
|
new "kill old restconf"
|
||||||
|
sleep $DEMSLEEP
|
||||||
stop_restconf_pre
|
stop_restconf_pre
|
||||||
|
|
||||||
new "test params: -f $cfg"
|
new "test params: -f $cfg"
|
||||||
|
|
@ -485,10 +486,9 @@ fi
|
||||||
#Start backend -s none should start
|
#Start backend -s none should start
|
||||||
|
|
||||||
new "kill restconf"
|
new "kill restconf"
|
||||||
|
sleep $DEMSLEEP
|
||||||
stop_restconf
|
stop_restconf
|
||||||
|
|
||||||
sleep $DEMSLEEP # Lots of processes need to die before next test
|
|
||||||
|
|
||||||
new "endtest"
|
new "endtest"
|
||||||
endtest
|
endtest
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue