Cannot read property 'length' of null exception

I have added a Zyxel VMG8825 to genieacs 1.1.3 and it seems to be causing crashes in cwmp. Other devices I have tested work fine.

I have one script that runs on 0 BOOTSTRAP and one that runs on 1 BOOT, I have removed all the code from them and I still get the error. The error seems to be inside the session handling anyway.

2019-09-16T16:16:51.863Z [INFO] snip 54833A-VMG8825%2DB50B-snip: Inform; cpeRequestId=“snip” informEvent=“0 BOOTSTRAP,1 BOOT,4 VALUE CHANGE” informRetryCount=10
2019-09-16T16:16:52.059Z [ERROR] Uncaught exception; pid=87013 exceptionName=“TypeError” exceptionMessage=“Cannot read property ‘length’ of null” exceptionStack=“TypeError: Cannot read property ‘length’ of null\n at /usr/local/genieacs/lib/cwmp.js:549:33\n at Object.rpcRequest (/usr/local/genieacs/lib/session.js:744:12)\n at nextRpc (/usr/local/genieacs/lib/cwmp.js:468:18)\n at /usr/local/genieacs/lib/cwmp.js:978:14\n at Object.timeoutOperations (/usr/local/genieacs/lib/session.js:371:12)\n at processRequest (/usr/local/genieacs/lib/cwmp.js:964:20)\n at parsedRpc (/usr/local/genieacs/lib/cwmp.js:1063:14)\n at /usr/local/genieacs/lib/cwmp.js:1128:16\n at getSession (/usr/local/genieacs/lib/cwmp.js:748:12)\n at IncomingMessage. (/usr/local/genieacs/lib/cwmp.js:1065:12)”

I have tried resetting the Zyxel and restarting genieacs. Still getting the same error.

Below are the soap packets (added spaces so the < and > show.

POST / HTTP/1.1
Content-Length: 2892
Content-Type: text/xml
HOST: snip
User-Agent: CyberGarage-HTTP/1.0

<SOAP-ENV:Envelope xmlns:SOAP-ENV=“snip” xmlns:SOAP-ENC=“snip” xmlns:cwmp=“urn:dslforum-org:cwmp-1-0” xmlns:xsi=“snip” xmlns:xsd=“snip”>
< SOAP-ENV:Header>
<cwmp:ID SOAP-ENV:mustUnderstand=“1”>snip</cwmp:ID>
</SOAP-ENV:Header>
< SOAP-ENV:Body>
< cwmp:Inform>
< DeviceId>
< Manufacturer>ZYXEL< /Manufacturer>
< OUI>54833A< /OUI>
< ProductClass>VMG8825-B50B< /ProductClass>
< SerialNumber>snip< /SerialNumber>
</ DeviceId>
< Event SOAP-ENC:arrayType=“cwmp:EventStruct[3]”>
< EventStruct>
< EventCode>0 BOOTSTRAP< /EventCode>
< CommandKey>
< /EventStruct>
< EventStruct>
< EventCode>1 BOOT< /EventCode>
< CommandKey>< /CommandKey>
< /EventStruct>
< EventStruct>
< EventCode>4 VALUE CHANGE< /EventCode>
< CommandKey>< /CommandKey>
< /EventStruct>
< /Event>
< MaxEnvelopes>1< /MaxEnvelopes>
< CurrentTime>2019-09-17T12:19:44< /CurrentTime>
< RetryCount>26
< ParameterList SOAP-ENC:arrayType=“cwmp:ParameterValueStruct[8]”>
< ParameterValueStruct>
< Name>InternetGatewayDevice.DeviceSummary< /Name>
< Value xsi:type=“xsd:string”>InternetGatewayDevice:1.4,VoiceService:1< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.DeviceInfo.SpecVersion< /Name>
< Value xsi:type=“xsd:string”>1.0< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.DeviceInfo.HardwareVersion< /Name>
< Value xsi:type=“xsd:string”>VMG8825-B50B< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.DeviceInfo.SoftwareVersion< /Name>
< Value xsi:type=“xsd:string”>V5.13(ABNY.2)C0< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.DeviceInfo.ProvisioningCode< /Name>
< Value xsi:type=“xsd:string”>< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.ManagementServer.ConnectionRequestURL< /Name>
< Value xsi:type=“xsd:string”>snip< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.ManagementServer.ParameterKey< /Name>
< Value xsi:type=“xsd:string”>< /Value>
< /ParameterValueStruct>
< ParameterValueStruct>
< Name>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress< /Name>
< Value xsi:type=“xsd:string”>snip< /Value>
< /ParameterValueStruct>
< /ParameterList>
< /cwmp:Inform>
< /SOAP-ENV:Body>
< /SOAP-ENV:Envelope>

HTTP/1.1 200 OK
Server: GenieACS/1.1.3
SOAPServer: GenieACS/1.1.3
Content-Type: text/xml; charset=“utf-8”
Set-Cookie: session=743665a3925bceda
Content-Length: 534
Date: Tue, 17 Sep 2019 10:19:44 GMT
Connection: keep-alive

< ?xml version=“1.0” encoding=“UTF-8”?>
< soap-env:Envelope xmlns:soap-enc=“snip” xmlns:soap-env=“snip” xmlns:xsd=“snip” xmlns:xsi=“snip” xmlns:cwmp=“urn:dslforum-org:cwmp-1-0”>< soap-env:Header><cwmp:ID soap-env:mustUnderstand=“1”>snip</cwmp:ID></soap-env:Header>< soap-env:Body>< cwmp:InformResponse>1</cwmp:InformResponse></soap-env:Body>< /soap-env:Envelope>

I looked at the code and noticed it was crashing when trying to run a task. I looked at the tasks list, and despite removing the device there was still an outstanding task that for some reason had a parameterValue of null.

{"_id":“5d7b9e8984f74dbd96f24091”,“parameterValues”:null,“name”:“setParameterValues”,“device”:“54833A-VMG8825%2DB50B-snip”,“timestamp”:“2019-09-13T13:50:01.169Z”}

I have deleted the task, and now it’s working as expected.