restconf fcgi mem leak in indata

test pkill needs sleep before name settles
This commit is contained in:
Olof hagsand 2021-06-27 16:32:10 +02:00
parent df05acdc9e
commit 3539a80d5e
6 changed files with 19 additions and 10 deletions

View file

@ -220,8 +220,11 @@ restconf_reply_send(void *req0,
return retval;
}
/*!
/*! Get input data from http request, eg such as curl -X PUT http://... <indata>
* @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 *
restconf_get_indata(void *req0)

View file

@ -172,9 +172,9 @@ restconf_reply_send(void *req0,
return retval;
}
/*! get input data
* @param[in] req Fastcgi request handle
* @note Pulls up an event buffer and then copies it to a cbuf. This is not efficient.
/*! Get input data from http request, eg such as curl -X PUT http://... <indata>
* @param[in] req Request handle
* @note: reuses cbuf from stream-data
*/
cbuf *
restconf_get_indata(void *req0)

View file

@ -588,6 +588,10 @@ api_root_restconf(clicon_handle h,
retval = 0;
done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
#ifdef WITH_RESTCONF_FCGI
if (cb)
cbuf_free(cb);
#endif
if (xerr)
xml_free(xerr);
if (username)

View file

@ -648,7 +648,7 @@ clixon_process_operation(clicon_handle h,
sched++;/* start: immediate stop/restart: not immediate: wait timeout */
}
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 */
}
@ -688,6 +688,7 @@ clixon_process_status(clicon_handle h,
pe = _proc_entry_list;
do {
if (strcmp(pe->pe_name, name) == 0){
clicon_debug(1, "%s found %s pid:%d", __FUNCTION__, name, pe->pe_pid);
/* Check if running */
run = 0;
if (pe->pe_pid && proc_op_run(pe->pe_pid, &run) < 0)

View file

@ -382,9 +382,10 @@ function stop_restconf_pre(){
}
# Stop restconf daemon after test
# Two caveats in pkill:
# Some problems with pkill:
# 1) Dont use $clixon_restconf (dont work in valgrind)
# 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(){
sudo pkill -f clixon_restconf
if [ $valgrindtest -eq 3 ]; then

View file

@ -167,6 +167,7 @@ cat<<EOF > $startupdb
EOF
new "kill old restconf"
sleep $DEMSLEEP
stop_restconf_pre
new "test params: -f $cfg"
@ -276,9 +277,8 @@ if [ $pid0 -eq $pid3 ]; then
fi
new "kill restconf using kill"
stop_restconf_pre
sleep $DEMSLEEP
stop_restconf_pre
new "Wait for restconf to stop"
wait_restconf_stopped
@ -378,6 +378,7 @@ cat<<EOF > $startupdb
EOF
new "kill old restconf"
sleep $DEMSLEEP
stop_restconf_pre
new "test params: -f $cfg"
@ -485,10 +486,9 @@ fi
#Start backend -s none should start
new "kill restconf"
sleep $DEMSLEEP
stop_restconf
sleep $DEMSLEEP # Lots of processes need to die before next test
new "endtest"
endtest