EasyCwmp - easycwmp
View Issue Details
0000231easycwmp[All Projects] Bugpublic2017-05-25 11:582017-05-26 11:19
andy_yang 
Anis 
immediateblockalways
resolvedfixed 
openwrt 15.0.1linuxlinux
0000231: easycwmpd console exit and CPE timeout when IPPingDiagnostics
I have rewrite the srcipt ipping_diagnostic and ipping_launch for my CPE test on the HuaWei's ITMS(ACS).I meet a probrom that easycwmpd console exit and CPE timeout when IPPingDiagnostics.
After the ACS save parameters sucess, that is, the ACS receive the SetParameterValuesResponse from the CPE.
then ,the ACS will read the result of ping Diagnostics immediately once.
1. set parameter DiagnosticsState is Requested, and host is 192.168.20.99
2. apply and check console.
3. the console printf "User defined signal 1" and then the CPE offline.
+++ RECEIVED HTTP RESPONSE +++
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" [^] xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" [^] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^] xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><SOAP-ENV:Header><cwmp:ID SOAP-ENV:mustUnderstand="1">-15239</cwmp:ID></SOAP-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><cwmp:SetParameterValues><ParameterList [^] SOAP-ENC:arrayType="cwmp:ParameterValueStruct[2]"><ParameterValueStruct xsi:type="cwmp:ParameterValueStruct"><Name xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.Host</Name><Value xsi:type="xsd:string">192.168.20.99</Value></ParameterValueStruct><ParameterValueStruct xsi:type="cwmp:ParameterValueStruct"><Name xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.DiagnosticsState</Name><Value xsi:type="xsd:string">Requested</Value></ParameterValueStruct></ParameterList><ParameterKey xsi:type="xsd:string"></ParameterKey></cwmp:SetParameterValues></SOAP-ENV:Body></SOAP-ENV:Envelope>
--- RECEIVED HTTP RESPONSE ---
2017-05-25 17:46:42 [easycwmp] NOTICE - received SetParameterValues method from the ACS
2017-05-25 17:46:42 [easycwmp] NOTICE - external: execute set value InternetGatewayDevice.IPPingDiagnostics.Host 192.168.20.99
2017-05-25 17:46:42 [easycwmp] NOTICE - external: execute set value InternetGatewayDevice.IPPingDiagnostics.DiagnosticsState Requested
2017-05-25 17:46:42 [easycwmp] NOTICE - external: execute apply value
2017-05-25 17:46:43 [easycwmp] NOTICE - send SetParameterValuesResponse to the ACS
+++ SEND HTTP REQUEST +++
<soap_env:Envelope
xmlns:soap_env="http://schemas.xmlsoap.org/soap/envelope/" [^]
xmlns:soap_enc="http://schemas.xmlsoap.org/soap/encoding/" [^]
xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^]
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^]
xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
 <soap_env:Header>
  <cwmp:ID soap_env:mustUnderstand="1">-15239</cwmp:ID>
 </soap_env:Header>
 <soap_env:Body>
  <cwmp:SetParameterValuesResponse>
   <Status>1</Status>
  </cwmp:SetParameterValuesResponse>
 </soap_env:Body>
</soap_env:Envelope>
--- SEND HTTP REQUEST ---
> POST /ACS-server/ACS HTTP/1.1
Host: 192.168.4.11:9090
User-Agent: easycwmp
Content-Type: text/xml; charset="utf-8"
SOAPAction:
Content-Length: 522

< HTTP/1.1 200 OK
< Content-Type: text/xml; charset="utf-8"
< Content-Length: 1704
<
+++ RECEIVED HTTP RESPONSE +++
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" [^] xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" [^] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^] xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><SOAP-ENV:Header><cwmp:ID SOAP-ENV:mustUnderstand="1">-15240</cwmp:ID></SOAP-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><cwmp:GetParameterValues><ParameterNames [^] SOAP-ENC:arrayType="xsd:string[12]"><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.AverageResponseTime</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.DSCP</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.DataBlockSize</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.DiagnosticsState</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.FailureCount</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.Host</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.Interface</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.MaximumResponseTime</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.MinimumResponseTime</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.NumberOfRepetitions</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.SuccessCount</string><string xsi:type="xsd:string">InternetGatewayDevice.IPPingDiagnostics.Timeout</string></ParameterNames></cwmp:GetParameterValues></SOAP-ENV:Body></SOAP-ENV:Envelope>
--- RECEIVED HTTP RESPONSE ---
2017-05-25 17:46:43 [easycwmp] NOTICE - received GetParameterValues method from the ACS
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.AverageResponseTime
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.DSCP
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.DataBlockSize
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.DiagnosticsState
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.FailureCount
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.Host
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.Interface
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.MaximumResponseTime
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.MinimumResponseTime
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.NumberOfRepetitions
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.SuccessCount
2017-05-25 17:46:43 [easycwmp] NOTICE - external: execute get value InternetGatewayDevice.IPPingDiagnostics.Timeout
User defined signal 1
No tags attached.
rar Test_log.rar (170,323) 2017-05-25 11:58
http://support.easycwmp.org/file_download.php?file_id=105&type=bug
Issue History
2017-05-25 11:58andy_yangNew Issue
2017-05-25 11:58andy_yangFile Added: Test_log.rar
2017-05-25 11:59andy_yangNote Added: 0000710
2017-05-25 12:07andy_yangNote Added: 0000711
2017-05-26 02:57andy_yangNote Added: 0000717
2017-05-26 11:19AnisStatusnew => resolved
2017-05-26 11:19AnisResolutionopen => fixed
2017-05-26 11:19AnisAssigned To => Anis

Notes
(0000710)
andy_yang   
2017-05-25 11:59   
more debug and log information, please refer to attachment (Test_log.rar).
Thanks!
(0000711)
andy_yang   
2017-05-25 12:07   
I analyse that easycwmpd console exit and CPE timeout and offline is because that my easycwmp funcition.

int external_init()
{
    log_message(NAME, L_NOTICE, "external script init\n");
    if (pipe(pfds_out) < 0)
            return -1;
    if (pipe(pfds_in) < 0)
            return -1;
    if ((pid = fork()) == -1) {
        log_message(NAME, L_CRIT, "external init fork failed\n");
        return -1;
    }

    if (pid == 0) {
        /* child */
        close(pfds_out[0]);
        dup2(pfds_out[1], STDOUT_FILENO);
        close(pfds_out[1]);

        close(pfds_in[1]);
        dup2(pfds_in[0], STDIN_FILENO);
        close(pfds_in[0]);

        int i=0;
        const char *argv[4];
        argv[i++] = fc_script;
        argv[i++] = "--json-input";
        argv[i++] = NULL;

        execvp(argv[0], (char **) argv);
        exit(ESRCH);
    } else if (pid < 0)
        return -1;


    close(pfds_out[1]);
    close(pfds_in[0]);

    if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
        log_message(NAME, L_CRIT, "ignoring pipe signal failed\n");

    int r = external_read_pipe(NULL);
    return r;
}
The function don't the sigal SIGHUP to handle. your idea? I'm urgent to know your analysis and solution,.
thanks!
(0000717)
andy_yang   
2017-05-26 02:57   
I add following code to capture the sigal SIGUSR1 in the external_init function.
......
   if (signal(SIGUSR1, SIG_IGN) == SIG_ERR)
    log_message(NAME, L_CRIT, "ignoring pipe signal failed\n");
......
 
The problem is fixed. Oh, it's my lucky!