# Bad session state

**URL:** <https://forum.genieacs.com/t/bad-session-state/32>\
**Category:** Uncategorized\
**Created:** [January 21, 2019, 11:57pm UTC](https://forum.genieacs.com/t/bad-session-state/32 "2019-01-21T23:57:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [January 21, 2019, 11:57pm UTC](https://forum.genieacs.com/t/bad-session-state/32/1 "2019-01-21T23:57:04Z")

</div>

Suddenly this afternoon I started getting “Bad session state” errors for a particular CPE. I’ve rebooted the CPE, CWMP and redis process to no avail. There is nothing remarkable in either the cwmp log or the debug log for the CPE. I’m not really sure how to debug this from here given that there isn’t any concrete error message. This error is occurring on my dev instance which has 3 active CPEs. This is the only CPE giving me this error.

I tried deleting the CPE from Genie and rebooted the device and still get the same error.

-dan

> 2019-01-21T23:46:36.454Z [INFO] 172.27.240.128 3c9066-963138\_T281\_C-SR555AA046%2D5000077: Inform; cpeRequestId=“1219693439” informEvent=“1 BOOT,4 VALUE CHANGE” informRetryCount=0  
> 2019-01-21T23:46:42.552Z [ERROR] 172.27.240.128 3c9066-963138\_T281\_C-SR555AA046%2D5000077: Bad session state

Due to limitations of discord, I had to edit the SOAP messages below to remove http://…

> REQUEST Mon Jan 21 2019 14:46:36 GMT-0900 (AKST)  
> {“host”:“172.24.254.12:7548”,“user-agent”:“CV2\_TR69\_CPE\_04\_00”,“connection”:“keep-alive”,“soapaction”:“”,“content-type”:“text/xml”,“content-length”:“3588”}  
> \<SOAP-ENV:Envelope  
> xmlns:SOAP-ENV=“…”  
> xmlns:SOAP-ENC=“…”  
> xmlns:xsd=“…”  
> xmlns:xsi=“…”  
> xmlns:cwmp=“urn:dslforum-org:cwmp-1-0”\>  
> \<SOAP-ENV:Header\>  
> \<cwmp:ID SOAP-ENV:mustUnderstand=“1”\>1219693439\</cwmp:ID\>  
> \</SOAP-ENV:Header\>  
> \<SOAP-ENV:Body\>  
> \<cwmp:Inform\>  
> \<DeviceId\>  
> \<Manufacturer\>SmartRG\</Manufacturer\>  
> \<OUI\>3c9066\</OUI\>  
> \<ProductClass\>963138\_T281\_C\</ProductClass\>  
> \<SerialNumber\>SR555AA046-5000077\</SerialNumber\>  
> \</DeviceId\>  
> \<Event SOAP-ENC:arrayType=“cwmp:EventStruct[2]”\>  
> \<EventStruct\>  
> \<EventCode\>1 BOOT\</EventCode\>  
> \<CommandKey\>\</CommandKey\>  
> \</EventStruct\>  
> \<EventStruct\>  
> \<EventCode\>4 VALUE CHANGE\</EventCode\>  
> \<CommandKey\>\</CommandKey\>  
> \</EventStruct\>  
> \</Event\>  
> \<MaxEnvelopes\>1\</MaxEnvelopes\>  
> \<CurrentTime\>2019-01-21T14:46:36+00:00\</CurrentTime\>  
> \<RetryCount\>0\</RetryCount\>  
> \<ParameterList SOAP-ENC:arrayType=“cwmp:ParameterValueStruct[0009]”\>  
> \<ParameterValueStruct\>  
> \<Name\>InternetGatewayDevice.DeviceSummary\</Name\>  
> \<Value xsi:type=“xsd:string”\>InternetGatewayDevice:1.4, X\_CISCO\_COM\_CAH: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”\>SR555ac\</Value\>  
> \</ParameterValueStruct\>  
> \<ParameterValueStruct\>  
> \<Name\>InternetGatewayDevice.DeviceInfo.SoftwareVersion\</Name\>  
> \<Value xsi:type=“xsd:string”\>2.6.1.2018:12:06:15:18:05\</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”\>…\</Value\>  
> \</ParameterValueStruct\>  
> \<ParameterValueStruct\>  
> \<Name\>InternetGatewayDevice.ManagementServer.ParameterKey\</Name\>  
> \<Value xsi:type=“xsd:string”\>(null)\</Value\>  
> \</ParameterValueStruct\>  
> \<ParameterValueStruct\>  
> \<Name\>InternetGatewayDevice.WANDevice.3.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress\</Name\>  
> \<Value xsi:type=“xsd:string”\>172.27.240.128\</Value\>  
> \</ParameterValueStruct\>  
> \<ParameterValueStruct\>  
> \<Name\>InternetGatewayDevice.WANDevice.3.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress\</Name\>  
> \<Value xsi:type=“xsd:string”\>172.27.240.128\</Value\>  
> \</ParameterValueStruct\>  
> \</ParameterList\>  
> \</cwmp:Inform\>  
> \</SOAP-ENV:Body\>  
> \</SOAP-ENV:Envelope\>  
>   
> # RESPONSE Mon Jan 21 2019 14:46:36 GMT-0900 (AKST)  
> {“Server”:“GenieACS/1.1.2”,“SOAPServer”:“GenieACS/1.1.2”,“Content-Type”:“text/xml; charset="utf-8"”,“Set-Cookie”:“session=2da851ae880bfc3f”}  
> \<?xml version=“1.0” encoding=“UTF-8”?\>  
> \<soap-env:Envelope xmlns:soap-enc=“…” xmlns:soap-env=“…” xmlns:xsd=“…” xmlns:xsi=“…” xmlns:cwmp=“urn:dslforum-org:cwmp-1-0”\>  
> \<soap-env:Header\>  
> \<cwmp:ID soap-env:mustUnderstand=“1”\>1219693439\</cwmp:ID\>  
> \</soap-env:Header\>  
> \<soap-env:Body\>  
> \<cwmp:InformResponse\>  
> \<MaxEnvelopes\>1\</MaxEnvelopes\>  
> \</cwmp:InformResponse\>  
> \</soap-env:Body\>  
> \</soap-env:Envelope\>

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [January 22, 2019, 5:18pm UTC](https://forum.genieacs.com/t/bad-session-state/32/2 "2019-01-22T17:18:58Z")

</div>

Hmm, factory defaulting the CPE seems to have resolved the issue. Not sure why. I previously had deleted the CPE out of Genie and reboot the device and still got the “Bad session state” error. Not real sure why factory defaulting the CPE would be different, unless the CPE was sending bad data to Genie.

---

<div class="post-metadata">

**Author:** ![zaidka](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/zaidka/32/9_2.png) [@zaidka](https://forum.genieacs.com/u/zaidka)\
**Post date:** [January 29, 2019, 9:24am UTC](https://forum.genieacs.com/t/bad-session-state/32/3 "2019-01-29T09:24:52Z")

</div>

The error message says that the request received doesn’t match the expected message type based on the flow of the session (e.g. CPE sends Inform twice in the same session). Can’t speculate why this happened or why a factory reset seems to have solved it! Next time it happens you can take a packet capture and it should be easy to spot the issue.
