ota demo killing shadow demo mqtt connection

Hi, i am running two demos first shadow demo executing and after  that i am calling OTA demo but when i call OTA demo after some time it kills my shadow connection below are the logs
32 900 [iot_thread] [INFO ][MQTT][9000] Establishing new MQTT connection.
33 900 [iot_thread] [INFO ][MQTT][9000] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
34 900 [iot_thread] [INFO ][MQTT][9000] (MQTT connection 0x3ffb40ec, CONNECT operation 0x3ffb6090) Waiting for operation completion.
35 930 [iot_thread] [INFO ][MQTT][9300] (MQTT connection 0x3ffb40ec, CONNECT operation 0x3ffb6090) Wait complete with result SUCCESS.
36 930 [iot_thread] [INFO ][MQTT][9300] New MQTT connection 0x3ffb3e08 established.
37 930 [iot_thread] [INFO ][Shadow][9300] (ESP_246F2825D19C) Modifying Shadow DELTA callback.
38 930 [iot_thread] [INFO ][Shadow][9300] (ESP_246F2825D19C) Adding new DELTA callback.
39 930 [iot_thread] [INFO ][MQTT][9300] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
40 930 [iot_thread] [INFO ][MQTT][9300] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9dcc) Waiting for operation completion.
41 950 [iot_thread] [INFO ][MQTT][9500] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9dcc) Wait complete with result SUCCESS.
42 950 [iot_thread] [INFO ][Shadow][9500] (ESP_246F2825D19C) Shadow DELTA callback operation complete with result SUCCESS.
43 950 [iot_thread] [INFO ][Shadow][9500] (ESP_246F2825D19C) Modifying Shadow UPDATED callback.
44 950 [iot_thread] [INFO ][Shadow][9500] (ESP_246F2825D19C) Adding new UPDATED callback.
45 950 [iot_thread] [INFO ][MQTT][9500] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
46 950 [iot_thread] [INFO ][MQTT][9500] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb5e6c) Waiting for operation completion.
47 970 [iot_thread] [INFO ][MQTT][9700] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb5e6c) Wait complete with result SUCCESS.
48 970 [iot_thread] [INFO ][Shadow][9700] (ESP_246F2825D19C) Shadow UPDATED callback operation complete with result SUCCESS.
49 970 [iot_thread] [INFO ][MQTT][9700] MQTT library successfully initialized.
50 970 [iot_thread] [INFO ][Shadow][9700] Shadow library successfully initialized.
51 971 [iot_thread] [INFO ][MQTT][9710] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
52 971 [iot_thread] [INFO ][MQTT][9710] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9dcc) Waiting for operation completion.
53 990 [iot_thread] [INFO ][MQTT][9900] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9dcc) Wait complete with result SUCCESS.
54 990 [iot_thread] [INFO ][MQTT][9900] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
55 990 [iot_thread] [INFO ][MQTT][9900] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6090) Waiting for operation completion.
56 1011 [iot_thread] [INFO ][MQTT][10110] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6090) Wait complete with result SUCCESS.
57 1011 [iot_thread] [INFO ][MQTT][10110] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
58 1043 [iot_thread] [INFO ][DEMO][10430] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":1,"switch_2":1,"switch_3":0,"switch_4":0},"reported":{"switch_1":0,"switch_2":1,"switc59 1044 [iot_thread] [INFO ][DEMO][10440] ESP_246F2825D19C changing state from 0 to 0.
60 1044 [iot_thread] [INFO ][MQTT][10440] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
61 1045 [iot_thread] [INFO ][DEMO][10450] ESP_246F2825D19C sent new state report.
62 1063 [iot_thread] [INFO ][Shadow][10630] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
63 1104 [iot_thread] [INFO ][DEMO][11040] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0},"reported":{"switch_1":0,"switch_2":1,"s65 1423 [iot_thread] [INFO ][MQTT][14230] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
66 1443 [IP-task] Network buffers: 57 lowest 57
67 1444 [iot_thread] [INFO ][DEMO][14440] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0},"reported":{"switch_1":0,"switch_2":0,"switc68 1445 [iot_thread] [INFO ][DEMO][14450] ESP_246F2825D19C changing state from 0 to 1.
69 1445 [iot_thread] [INFO ][MQTT][14450] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
70 1445 [iot_thread] [INFO ][DEMO][14450] ESP_246F2825D19C sent new state report.
71 1462 [iot_thread] [INFO ][Shadow][14620] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
72 1462 [iot_thread] [INFO ][MQTT][14620] MQTT library successfully initialized.
73 1462 [iot_thread] OTA demo version 0.9.2
74 1462 [iot_thread] Creating MQTT Client...
75 1498 [IP-task] Heap: current 37340 lowest 37200
76 1499 [IP-task] Heap: current 36616 lowest 36480
77 1499 [iot_thread] [INFO ][DEMO][14990] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":1,"switch_3":0,"switch_4":0},"reported":{"switch_1":0,"switch_2":0,"switc78 1500 [IP-task] Heap: current 37340 lowest 36260
79 1500 [iot_thread] [INFO ][Shadow][15000] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
80 1522 [wifi] Heap: current 36072 lowest 35796
81 1523 [wifi] Heap: current 36004 lowest 35600
82 1523 [wifi] Heap: current 35956 lowest 34848
83 1523 [wifi] Heap: current 35908 lowest 34800
84 1523 [IP-task] Network buffers: 57 lowest 56
85 1523 [IP-task] Heap: current 32712 lowest 32248
86 1523 [IP-task] Heap: current 33100 lowest 32240
87 1594 [wifi] Heap: current 21912 lowest 21100
88 1599 [IP-task] Heap: current 21340 lowest 20428
89 1625 [wifi] Heap: current 20172 lowest 20068
90 1625 [wifi] Heap: current 21576 lowest 19636
91 1666 [wifi] Heap: current 17708 lowest 17604
92 1696 [wifi] Heap: current 16248 lowest 10972
93 1778 [wifi] Heap: current 9760 lowest 9672
94 1789 [wifi] Heap: current 12268 lowest 9388
95 1901 [wifi] Heap: current 5816 lowest 5720
96 1922 [wifi] Heap: current 5816 lowest 5436
97 2003 [wifi] Heap: current 9104 lowest 5288
246F2825D19C
thing_name:ESP_246F2825D19C
246F2825D19C
thing_name:ESP_246F2825D19C
98 2038 [iot_thread] Connecting to broker...
99 2038 [iot_thread] printing mac address:100 2038 [iot_thread] printing mac address:101 2038 [iot_thread] [INFO ][MQTT][20380] Establishing new MQTT connection.
102 2038 [iot_thread] [INFO ][MQTT][20380] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
103 2038 [iot_thread] [INFO ][MQTT][20380] (MQTT connection 0x3ffd8ce4, CONNECT operation 0x3ffd8334) Waiting for operation completion.
246F2825D19C
thing_name:ESP_246F2825D19C
104 2061 [iot_thread] [INFO ][MQTT][20610] (MQTT connection 0x3ffd8ce4, CONNECT operation 0x3ffd8334) Wait complete with result SUCCESS.
105 2061 [iot_thread] [INFO ][MQTT][20610] New MQTT connection 0x3ffbf78c established.
106 2061 [iot_thread] Connected to broker.
107 2061 [iot_thread] printing mac address:108 2062 [iot_thread] [OTA_AgentInit_internal] OTA Task is Ready.
109 2063 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [Ready] Event [Start] New state [RequestingJob]
110 2063 [OTA Agent Task] [INFO ][MQTT][20630] (MQTT connection 0x3ffd8ce4) SUBSCRIBE operation scheduled.
111 2063 [OTA Agent Task] [INFO ][MQTT][20630] (MQTT connection 0x3ffd8ce4, SUBSCRIBE operation 0x3ffd8334) Waiting for operation completion.
112 2086 [OTA Agent Task] [INFO ][MQTT][20860] (MQTT connection 0x3ffd8ce4, SUBSCRIBE operation 0x3ffd8334) Wait complete with result SUCCESS.
113 2086 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/$next/get/accepted
114 2087 [OTA Agent Task] [INFO ][MQTT][20870] (MQTT connection 0x3ffd8ce4) SUBSCRIBE operation scheduled.
115 2087 [OTA Agent Task] [INFO ][MQTT][20870] (MQTT connection 0x3ffd8ce4, SUBSCRIBE operation 0x3ffd8334) Waiting for operation completion.
116 2107 [OTA Agent Task] [INFO ][MQTT][21070] (MQTT connection 0x3ffd8ce4, SUBSCRIBE operation 0x3ffd8334) Wait complete with result SUCCESS.
117 2107 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/notify-next
118 2107 [OTA Agent Task] [prvRequestJob_Mqtt] Request #0
119 2107 [OTA Agent Task] [INFO ][MQTT][21070] (MQTT connection 0x3ffd8ce4) MQTT PUBLISH operation queued.
120 2107 [OTA Agent Task] [INFO ][MQTT][21070] (MQTT connection 0x3ffd8ce4, PUBLISH operation 0x3ffd8334) Waiting for operation completion.
121 2128 [OTA Agent Task] [INFO ][MQTT][21280] (MQTT connection 0x3ffd8ce4, PUBLISH operation 0x3ffd8334) Wait complete with result SUCCESS.
122 2128 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [RequestingJob] Event [RequestJobDocument] New state [WaitingForJob]
I (21635) ota_pal: prvPAL_SetPlatformImageState, 4
W (21635) ota_pal: Set image as aborted!
I (21635) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (21645) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
W (21655) ota_pal: Image not in self test mode 2
I (21655) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
123 2130 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
124 2130 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
125 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: execution
126 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobId
127 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobDocument
128 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: afr_ota
129 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: protocols
130 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: files
131 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filepath
132 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filesize
133 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: fileid
134 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: certfile
135 2130 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: sig-sha256-ecdsa
136 2130 [OTA Agent Task] [prvDefaultCustomJobCallback] Received Custom Job inside OTA Agent which is not supported.
137 2130 [OTA Agent Task] [prvParseJobDoc] Ignoring job without ID.
138 2130 [OTA Agent Task] [prvOTA_Close] Context->0x0x3fff3e70
I (21675) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
139 2145 [OTA Agent Task] [prvOTAAgentTask] Handler failed. Current State [WaitingForJob] Event  [ReceivedJobDocument] Error Code [603979776]
140 2162 [iot_thread] State: Ready  Received: 1   Queued: 0   Processed: 0   Dropped: 0
141 2262 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
142 2362 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
143 2462 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
144 2562 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
145 2662 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
146 2762 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
147 2862 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
148 2962 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
149 3062 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
150 3162 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
151 3262 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
152 3362 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
153 3462 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
154 3562 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
155 3662 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
156 3762 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
157 3862 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
158 3962 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
159 4062 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
160 4162 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
161 4262 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
162 4362 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
163 4462 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
164 4562 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
165 4662 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
166 4762 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
167 4862 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
168 4962 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
169 5062 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
170 5162 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
171 5262 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
172 5362 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
173 5462 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
174 5562 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
175 5662 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
176 5762 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
177 5862 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
178 5962 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
179 6062 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
180 6162 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
181 6262 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
182 6362 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
183 6462 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
184 6562 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
185 6662 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
186 6762 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
187 6862 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
188 6930 [iot_thread] [ERROR][NET][69300] Error -27648 while sending data.
189 6930 [iot_thread] [ERROR][MQTT][69300] (MQTT connection 0x3ffb40ec) Failed to send PINGREQ.
190 6931 [iot_thread] [INFO ][MQTT][69310] (MQTT connection 0x3ffb40ec) Network connection closed.
191 6962 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
192 7062 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0

this is the another logs when i call two demos at a time
7 630 [iot_thread] [INFO ][MQTT][6300] MQTT library successfully initialized.
28 630 [iot_thread] [INFO ][Shadow][6300] Shadow library successfully initialized.
29 630 [iot_thread] [INFO ][DEMO][6300] Shadow Thing Name is ESP_246F2825D19C (length 16).
30 636 [iot_thread] DNS[0xCDF5]: The answer to 'a1l1zbts62o6u8-ats.iot.eu-west-1.amazonaws.com' (22fb8fc7ip) will be stored
31 637 [IP-task] Heap: current 110224 lowest 97668
32 638 [main] DNS[0x8F46]: The answer to 'a1l1zbts62o6u8-ats.iot.eu-west-1.amazonaws.com' (22fb8fc7ip) will be stored
I (6900) PKCS11: Initializing NVS partition: "storage"
33 670 [wifi] Heap: current 96036 lowest 95428
34 676 [IP-task] Heap: current 76504 lowest 76304
35 693 [IP-task] Heap: current 45552 lowest 45404
36 693 [wifi] Heap: current 44296 lowest 44148
37 695 [wifi] Heap: current 44296 lowest 43864
38 695 [IP-task] Heap: current 41804 lowest 41656
39 696 [wifi] Heap: current 41072 lowest 40924
40 696 [IP-task] Heap: current 41616 lowest 39964
41 728 [IP-task] Heap: current 39404 lowest 39256
42 729 [wifi] Heap: current 38672 lowest 38524
43 729 [IP-task] Heap: current 39208 lowest 37556
44 764 [wifi] Heap: current 37868 lowest 36828
45 768 [wifi] Heap: current 28172 lowest 26644
46 772 [wifi] Heap: current 25172 lowest 25116
47 773 [wifi] Heap: current 26580 lowest 24832
48 781 [wifi] Heap: current 24860 lowest 24820
49 781 [IP-task] Heap: current 24620 lowest 23852
50 865 [wifi] Heap: current 20908 lowest 15984
51 1049 [wifi] Heap: current 15628 lowest 15352
52 1069 [wifi] Heap: current 10752 lowest 10748
53 1073 [IP-task] Heap: current 11780 lowest 10464
54 1121 [wifi] Heap: current 10336 lowest 10332
55 1172 [wifi] Heap: current 13008 lowest 10048
56 1182 [wifi] Heap: current 4080 lowest 4080
57 1195 [IP-task] Heap: current 5116 lowest 3796
58 1196 [iot_thread] [INFO ][MQTT][11960] Establishing new MQTT connection.
59 1196 [iot_thread] [ERROR][NET][11960] Failed to create network receive task.
60 1196 [iot_thread] [ERROR][MQTT][11960] Failed to set MQTT network receive callback.
61 1196 [iot_thread] [ERROR][MQTT][11960] Failed to establish new MQTT connection, error NETWORK ERROR.
62 1196 [iot_thread] [INFO ][MQTT][11960] Network connection closed on error.
63 1198 [iot_thread] [INFO ][MQTT][11980] (MQTT connection 0x3ffd83b4) Network connection destroyed.
64 1198 [iot_thread] [ERROR][DEMO][11980] MQTT CONNECT returned error NETWORK ERROR.
65 1198 [iot_thread] [INFO ][DEMO][11980] Shadow Thing Name is ESP_246F2825D19C (length 16).
66 1402 [iot_thread] ERROR: Handshake failed with error code -16
67 1402 [iot_thread] [ERROR][NET][14020] Failed to establish new connection. Socket status: -1002.
68 1403 [iot_thread] [ERROR][MQTT][14030] Failed to establish new MQTT connection, error NETWORK ERROR.
69 1403 [iot_thread] [ERROR][DEMO][14030] MQTT CONNECT returned error NETWORK ERROR.
70 1404 [iot_thread] [INFO ][DEMO][14040] Shadow Thing Name is ESP_246F2825D19C (length 16).
71 1405 [IP-task] Heap: current 55788 lowest 1228
72 1615 [iot_thread] ERROR: Handshake failed with error code -16
73 1615 [iot_thread] [ERROR][NET][16150] Failed to establish new connection. Socket status: -1002.
74 1616 [iot_thread] [ERROR][MQTT][16160] Failed to establish new MQTT connection, error NETWORK ERROR.
75 1616 [iot_thread] [ERROR][DEMO][16160] MQTT CONNECT returned error NETWORK ERROR.
76 1617 [iot_thread] [INFO ][DEMO][16170] Shadow Thing Name is ESP_246F2825D19C (length 16).
77 1618 [IP-task] Heap: current 52564 lowest 1072
78 1748 [iot_thread] ERROR: Handshake failed with error code -9984
79 1748 [iot_thread] [ERROR][NET][17480] Failed to establish new connection. Socket status: -1002.
80 1748 [iot_thread] [ERROR][MQTT][17480] Failed to establish new MQTT connection, error NETWORK ERROR.
81 1749 [iot_thread] [ERROR][DEMO][17490] MQTT CONNECT returned error NETWORK ERROR.
82 1750 [iot_thread] [INFO ][DEMO][17500] Shadow Thing Name is ESP_246F2825D19C (length 16).
83 1956 [iot_thread] ERROR: Handshake failed with error code -16
84 1956 [iot_thread] [ERROR][NET][19560] Failed to establish new connection. Socket status: -1002.
85 1956 [iot_thread] [ERROR][MQTT][19560] Failed to establish new MQTT connection, error NETWORK ERROR.
86 1956 [iot_thread] [ERROR][DEMO][19560] MQTT CONNECT returned error NETWORK ERROR.
87 1957 [iot_thread] [INFO ][DEMO][19570] Shadow Thing Name is ESP_246F2825D19C (length 16).
88 1959 [main] Connecting to broker...
89 1959 [main] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
90 1960 [main] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
91 1960 [main] [INFO ][MQTT][19600] Establishing new MQTT connection.
92 1961 [main] [INFO ][MQTT][19610] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
93 1963 [main] [INFO ][MQTT][19630] (MQTT connection 0x3ffd99b8, CONNECT operation 0x3ffd8fe4) Waiting for operation completion.
94 2000 [main] [INFO ][MQTT][20000] (MQTT connection 0x3ffd99b8, CONNECT operation 0x3ffd8fe4) Wait complete with result SUCCESS.
95 2000 [main] [INFO ][MQTT][20000] New MQTT connection 0x3ffbf65c established.
96 2001 [main] Connected to broker.
97 2001 [main] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
98 2002 [main] [OTA_AgentInit_internal] OTA Task is Ready.
99 2003 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [Ready] Event [Start] New state [RequestingJob]
100 2003 [OTA Agent Task] [INFO ][MQTT][20030] (MQTT connection 0x3ffd99b8) SUBSCRIBE operation scheduled.
101 2003 [OTA Agent Task] [INFO ][MQTT][20030] (MQTT connection 0x3ffd99b8, SUBSCRIBE operation 0x3ffd8fe4) Waiting for operation completion.
102 2023 [OTA Agent Task] [INFO ][MQTT][20230] (MQTT connection 0x3ffd99b8, SUBSCRIBE operation 0x3ffd8fe4) Wait complete with result SUCCESS.
103 2023 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/$next/get/accepted
104 2023 [OTA Agent Task] [INFO ][MQTT][20230] (MQTT connection 0x3ffd99b8) SUBSCRIBE operation scheduled.
105 2023 [OTA Agent Task] [INFO ][MQTT][20230] (MQTT connection 0x3ffd99b8, SUBSCRIBE operation 0x3ffd8fe4) Waiting for operation completion.
106 2043 [OTA Agent Task] [INFO ][MQTT][20430] (MQTT connection 0x3ffd99b8, SUBSCRIBE operation 0x3ffd8fe4) Wait complete with result SUCCESS.
107 2043 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/notify-next
108 2043 [OTA Agent Task] [prvRequestJob_Mqtt] Request #0
109 2043 [OTA Agent Task] [INFO ][MQTT][20430] (MQTT connection 0x3ffd99b8) MQTT PUBLISH operation queued.
110 2043 [OTA Agent Task] [INFO ][MQTT][20430] (MQTT connection 0x3ffd99b8, PUBLISH operation 0x3ffd8fe4) Waiting for operation completion.
111 2064 [OTA Agent Task] [INFO ][MQTT][20640] (MQTT connection 0x3ffd99b8, PUBLISH operation 0x3ffd8fe4) Wait complete with result SUCCESS.
112 2064 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [RequestingJob] Event [RequestJobDocument] New state [WaitingForJob]
113 2065 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
114 2065 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
115 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: execution
116 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobId
117 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobDocument
118 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: afr_ota
119 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: protocols
120 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: files
121 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filepath
122 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filesize
123 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: fileid
124 2065 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: certfile
125 2067 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: sig-sha256-ecdsa
126 2067 [OTA Agent Task] [prvDefaultCustomJobCallback] Received Custom Job inside OTA Agent which is not supported.
127 2067 [OTA Agent Task] [prvParseJobDoc] Ignoring job without ID.
128 2067 [OTA Agent Task] [prvOTA_Close] Context->0x0x3ffec490
I (20960) ota_pal: prvPAL_SetPlatformImageState, 4
W (21060) ota_pal: Set image as aborted!
I (21070) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (21070) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
W (21080) ota_pal: Image not in self test mode 2
I (21090) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (21090) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
129 2081 [OTA Agent Task] [prvOTAAgentTask] Handler failed. Current State [WaitingForJob] Event  [ReceivedJobDocument] Error Code [603979776]
130 2171 [iot_thread] ERROR: Handshake failed with error code -16
131 2171 [iot_thread] [ERROR][NET][21710] Failed to establish new connection. Socket status: -1002.
132 2171 [iot_thread] [ERROR][MQTT][21710] Failed to establish new MQTT connection, error NETWORK ERROR.
133 2171 [iot_thread] [ERROR][DEMO][21710] MQTT CONNECT returned error NETWORK ERROR.
134 2172 [iot_thread] [INFO ][DEMO][21720] Shadow Thing Name is ESP_246F2825D19C (length 16).
135 2174 [main] State: RequestingJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
136 2275 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
137 2386 [iot_thread] ERROR: Handshake failed with error code -16
138 2386 [iot_thread] [ERROR][NET][23860] Failed to establish new connection. Socket status: -1002.
139 2387 [iot_thread] [ERROR][MQTT][23870] Failed to establish new MQTT connection, error NETWORK ERROR.
140 2387 [iot_thread] [ERROR][DEMO][23870] MQTT CONNECT returned error NETWORK ERROR.
141 2388 [iot_thread] [INFO ][DEMO][23880] Shadow Thing Name is ESP_246F2825D19C (length 16).
142 2389 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
143 2490 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
144 2601 [iot_thread] ERROR: Handshake failed with error code -16
145 2601 [iot_thread] [ERROR][NET][26010] Failed to establish new connection. Socket status: -1002.
146 2602 [iot_thread] [ERROR][MQTT][26020] Failed to establish new MQTT connection, error NETWORK ERROR.
147 2602 [iot_thread] [ERROR][DEMO][26020] MQTT CONNECT returned error NETWORK ERROR.
148 2603 [iot_thread] [INFO ][DEMO][26030] Shadow Thing Name is ESP_246F2825D19C (length 16).
149 2604 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
150 2705 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
151 2816 [iot_thread] ERROR: Handshake failed with error code -16
152 2816 [iot_thread] [ERROR][NET][28160] Failed to establish new connection. Socket status: -1002.
153 2817 [iot_thread] [ERROR][MQTT][28170] Failed to establish new MQTT connection, error NETWORK ERROR.
154 2817 [iot_thread] [ERROR][DEMO][28170] MQTT CONNECT returned error NETWORK ERROR.
155 2818 [iot_thread] [INFO ][DEMO][28180] Shadow Thing Name is ESP_246F2825D19C (length 16).
156 2819 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
157 2920 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
158 3032 [iot_thread] ERROR: Handshake failed with error code -16
159 3032 [iot_thread] [ERROR][NET][30320] Failed to establish new connection. Socket status: -1002.
160 3032 [iot_thread] [ERROR][MQTT][30320] Failed to establish new MQTT connection, error NETWORK ERROR.
161 3032 [iot_thread] [ERROR][DEMO][30320] MQTT CONNECT returned error NETWORK ERROR.
162 3033 [iot_thread] [INFO ][DEMO][30330] Shadow Thing Name is ESP_246F2825D19C (length 16).
163 3035 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
164 3136 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
165 3247 [iot_thread] ERROR: Handshake failed with error code -16
166 3247 [iot_thread] [ERROR][NET][32470] Failed to establish new connection. Socket status: -1002.
167 3247 [iot_thread] [ERROR][MQTT][32470] Failed to establish new MQTT connection, error NETWORK ERROR.
168 3247 [iot_thread] [ERROR][DEMO][32470] MQTT CONNECT returned error NETWORK ERROR.
169 3248 [iot_thread] [INFO ][DEMO][32480] Shadow Thing Name is ESP_246F2825D19C (length 16).
170 3250 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
171 3351 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
172 3461 [iot_thread] ERROR: Handshake failed with error code -16
173 3461 [iot_thread] [ERROR][NET][34610] Failed to establish new connection. Socket status: -1002.
174 3462 [iot_thread] [ERROR][MQTT][34620] Failed to establish new MQTT connection, error NETWORK ERROR.
175 3462 [iot_thread] [ERROR][DEMO][34620] MQTT CONNECT returned error NETWORK ERROR.
176 3463 [iot_thread] [INFO ][DEMO][34630] Shadow Thing Name is ESP_246F2825D19C (length 16).
177 3464 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
178 3565 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
179 3676 [iot_thread] ERROR: Handshake failed with error code -16
180 3676 [iot_thread] [ERROR][NET][36760] Failed to establish new connection. Socket status: -1002.
181 3677 [iot_thread] [ERROR][MQTT][36770] Failed to establish new MQTT connection, error NETWORK ERROR.
182 3677 [iot_thread] [ERROR][DEMO][36770] MQTT CONNECT returned error NETWORK ERROR.
183 3678 [iot_thread] [INFO ][DEMO][36780] Shadow Thing Name is ESP_246F2825D19C (length 16).
184 3679 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
185 3780 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
186 3891 [iot_thread] ERROR: Handshake failed with error code -16
187 3891 [iot_thread] [ERROR][NET][38910] Failed to establish new connection. Socket status: -1002.
188 3892 [iot_thread] [ERROR][MQTT][38920] Failed to establish new MQTT connection, error NETWORK ERROR.
189 3892 [iot_thread] [ERROR][DEMO][38920] MQTT CONNECT returned error NETWORK ERROR.
190 3893 [iot_thread] [INFO ][DEMO][38930] Shadow Thing Name is ESP_246F2825D19C (length 16).
191 3895 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
192 3995 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
193 4113 [iot_thread] ERROR: Handshake failed with error code -16
194 4113 [iot_thread] [ERROR][NET][41130] Failed to establish new connection. Socket status: -1002.
195 4113 [iot_thread] [ERROR][MQTT][41130] Failed to establish new MQTT connection, error NETWORK ERROR.
196 4113 [iot_thread] [ERROR][DEMO][41130] MQTT CONNECT returned error NETWORK ERROR.
197 4114 [iot_thread] [INFO ][DEMO][41140] Shadow Thing Name is ESP_246F2825D19C (length 16).
198 4115 [IP-task] Heap: current 58080 lowest 1000
199 4116 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
200 4217 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
201 4331 [iot_thread] ERROR: Handshake failed with error code -16
202 4332 [iot_thread] [ERROR][NET][43320] Failed to establish new connection. Socket status: -1002.
203 4332 [iot_thread] [ERROR][MQTT][43320] Failed to establish new MQTT connection, error NETWORK ERROR.
204 4332 [iot_thread] [ERROR][DEMO][43320] MQTT CONNECT returned error NETWORK ERROR.
205 4333 [iot_thread] [INFO ][DEMO][43330] Shadow Thing Name is ESP_246F2825D19C (length 16).
206 4335 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
207 4435 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
208 4547 [iot_thread] ERROR: Handshake failed with error code -16
209 4548 [iot_thread] [ERROR][NET][45480] Failed to establish new connection. Socket status: -1002.
210 4548 [iot_thread] [ERROR][MQTT][45480] Failed to establish new MQTT connection, error NETWORK ERROR.
211 4548 [iot_thread] [ERROR][DEMO][45480] MQTT CONNECT returned error NETWORK ERROR.
212 4549 [iot_thread] [INFO ][DEMO][45490] Shadow Thing Name is ESP_246F2825D19C (length 16).
213 4551 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
214 4651 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
215 4762 [iot_thread] ERROR: Handshake failed with error code -16
216 4762 [iot_thread] [ERROR][NET][47620] Failed to establish new connection. Socket status: -1002.
217 4762 [iot_thread] [ERROR][MQTT][47620] Failed to establish new MQTT connection, error NETWORK ERROR.
218 4762 [iot_thread] [ERROR][DEMO][47620] MQTT CONNECT returned error NETWORK ERROR.
219 4763 [iot_thread] [INFO ][DEMO][47630] Shadow Thing Name is ESP_246F2825D19C (length 16).
220 4765 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
221 4866 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
222 4977 [iot_thread] ERROR: Handshake failed with error code -16
223 4977 [iot_thread] [ERROR][NET][49770] Failed to establish new connection. Socket status: -1002.
224 4977 [iot_thread] [ERROR][MQTT][49770] Failed to establish new MQTT connection, error NETWORK ERROR.
225 4977 [iot_thread] [ERROR][DEMO][49770] MQTT CONNECT returned error NETWORK ERROR.
226 4978 [iot_thread] [INFO ][DEMO][49780] Shadow Thing Name is ESP_246F2825D19C (length 16).
227 4980 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
228 5081 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
229 5192 [iot_thread] ERROR: Handshake failed with error code -16
230 5192 [iot_thread] [ERROR][NET][51920] Failed to establish new connection. Socket status: -1002.
231 5193 [iot_thread] [ERROR][MQTT][51930] Failed to establish new MQTT connection, error NETWORK ERROR.
232 5193 [iot_thread] [ERROR][DEMO][51930] MQTT CONNECT returned error NETWORK ERROR.
233 5194 [iot_thread] [INFO ][DEMO][51940] Shadow Thing Name is ESP_246F2825D19C (length 16).
234 5195 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
235 5296 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
236 5407 [iot_thread] ERROR: Handshake failed with error code -16
237 5407 [iot_thread] [ERROR][NET][54070] Failed to establish new connection. Socket status: -1002.
238 5407 [iot_thread] [ERROR][MQTT][54070] Failed to establish new MQTT connection, error NETWORK ERROR.
239 5408 [iot_thread] [ERROR][DEMO][54070] MQTT CONNECT returned error NETWORK ERROR.
240 5409 [iot_thread] [INFO ][DEMO][54090] Shadow Thing Name is ESP_246F2825D19C (length 16).
241 5410 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
242 5511 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
243 5622 [iot_thread] ERROR: Handshake failed with error code -16
244 5622 [iot_thread] [ERROR][NET][56220] Failed to establish new connection. Socket status: -1002.
245 5622 [iot_t

Hi sameerdasarwad ,
Are you using the same client ID for the Shadow and OTA connections? If this is the case, then you will need update the demo client ids so that they are unique relative to each other.
Two clients with the same client ID are not allowed to be connected concurrently to the message broker. When a client connects to the message broker using a client ID that another client is using, the new client connection is accepted and the previously connected client is disconnected.
See the following link for details:
https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html

both demo using separate network , but not sure about client id or client token your saying i mean client id is client token

@param[in] pIdentifier NULL-terminated MQTT client identifier. The Shadow

demo will use the Thing Name as the client identifier.
above line for shadow demo but i didn't find about ota demo

both demo using separate network , but not sure about client id or client token your saying i mean client id is client token

Just to clarify, MQTT client IDs aren't associated with a Thing in AWS IoT. They are only used to uniquely identify the MQTT connection. Also, the client ID does not need to be set to the Thing name, that is just what was used in the demos.
The client token is unrelated to the MQTT client ID. It's a property of a Device Shadow Service Document. Client tokens are used by the Shadow Library to associate responses with requests in an MQTT environment. The OTA Library does not have the concept of client tokens.

@param[in] pIdentifier NULL-terminated MQTT client identifier. The Shadow

demo will use the Thing Name as the client identifier.
above line for shadow demo but i didn't find about ota demo
if  i want to send ota update for same thing at that time if ota demo uses same client id as per shadow demo comment, it means  that it will kill shadow demo connection and shadow will not update by default until ota demo finish or terminate

Your understanding is correct, the Shadow Library demo is using the thing name for the client identifier. The OTA demo is also using the Thing name as the client identifier. The define that the OTA and Shadow demos are using can be found in the "aws_clientcredential.h" file. https://github.com/aws/amazon-freertos/blob/94797e54a8ad1f61bb08a63857e7b3d1541d1d64/demos/include/aws_clientcredential.h#L41
As you pointed out, this causes the MQTT connection created by the Shadow Library demo to disconnect when the OTA demo tries to connect.
In the OTA demo code, you can see where the demo:

Creates a "xConnectInfo" variable of type "IotMqttConnectInfo_t" for setting the MQTT connection information: https://github.com/aws/amazon-freertos/blob/94797e54a8ad1f61bb08a63857e7b3d1541d1d64/demos/ota/aws_iot_ota_update_demo.c#L209
Sets the "pClientIdentifier" field of "xConnectInfo" to be the Thing name: https://github.com/aws/amazon-freertos/blob/94797e54a8ad1f61bb08a63857e7b3d1541d1d64/demos/ota/aws_iot_ota_update_demo.c#L242-L243
Creates the MQTT connection with the previously defined connection information https://github.com/aws/amazon-freertos/blob/94797e54a8ad1f61bb08a63857e7b3d1541d1d64/demos/ota/aws_iot_ota_update_demo.c#L246-L248

You will need to update the code in step 2 to use a client identifier that is different from the shadow library. In this case, you will need to set it to something other than the Thing name.

@yanjos-dev  thanks for valueable information, but when i change the OTA client Identifier same thing happening again below are the logs
20 640 [iot_thread] [INFO ][MQTT][6400] MQTT library successfully initialized.
21 640 [iot_thread] [INFO ][Shadow][6400] Shadow library successfully initialized.
22 641 [iot_thread] [INFO ][DEMO][6410] Shadow Thing Name is ESP_246F2825D19C (length 16).
23 650 [iot_thread] DNS[0x40E4]: The answer to 'xxxxxxxxxxxx-ats.iot.eu-west-1.amazonaws.com' (34d4a7ebip) will be stored
24 650 [IP-task] Heap: current 115396 lowest 102124
I (7045) PKCS11: Initializing NVS partition: "storage"
25 680 [wifi] Heap: current 101104 lowest 100428
26 687 [IP-task] Heap: current 81872 lowest 81800
27 711 [wifi] Heap: current 81052 lowest 80104
28 711 [IP-task] Heap: current 78760 lowest 78584
29 711 [wifi] Heap: current 78024 lowest 77076
30 712 [IP-task] Heap: current 78564 lowest 76304
31 782 [wifi] Heap: current 66300 lowest 65580
32 788 [IP-task] Heap: current 65720 lowest 64908
33 803 [wifi] Heap: current 64896 lowest 64896
34 813 [wifi] Heap: current 64680 lowest 64452
35 814 [IP-task] Heap: current 64900 lowest 64396
36 885 [wifi] Heap: current 59936 lowest 55468
37 967 [wifi] Heap: current 54148 lowest 54148
38 977 [wifi] Heap: current 57152 lowest 53864
39 1089 [wifi] Heap: current 50200 lowest 50200
40 1100 [wifi] Heap: current 50200 lowest 49916
41 1171 [wifi] Heap: current 49784 lowest 49784
42 1182 [wifi] Heap: current 49784 lowest 49340
43 1224 [iot_thread] [INFO ][MQTT][12240] Establishing new MQTT connection.
44 1224 [iot_thread] [INFO ][MQTT][12240] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
45 1224 [iot_thread] [INFO ][MQTT][12240] (MQTT connection 0x3ffb9b9c, CONNECT operation 0x3ffb9cb8) Waiting for operation completion.
46 1255 [iot_thread] [INFO ][MQTT][12550] (MQTT connection 0x3ffb9b9c, CONNECT operation 0x3ffb9cb8) Wait complete with result SUCCESS.
47 1255 [iot_thread] [INFO ][MQTT][12550] New MQTT connection 0x3ffb3e08 established.
48 1255 [iot_thread] [INFO ][Shadow][12550] (ESP_246F2825D19C) Modifying Shadow DELTA callback.
49 1255 [iot_thread] [INFO ][Shadow][12550] (ESP_246F2825D19C) Adding new DELTA callback.
50 1255 [iot_thread] [INFO ][MQTT][12550] (MQTT connection 0x3ffb9b9c) SUBSCRIBE operation scheduled.
51 1255 [iot_thread] [INFO ][MQTT][12550] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffd7ba0) Waiting for operation completion.
52 1275 [iot_thread] [INFO ][MQTT][12750] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffd7ba0) Wait complete with result SUCCESS.
53 1275 [iot_thread] [INFO ][Shadow][12750] (ESP_246F2825D19C) Shadow DELTA callback operation complete with result SUCCESS.
54 1275 [iot_thread] [INFO ][Shadow][12750] (ESP_246F2825D19C) Modifying Shadow UPDATED callback.
55 1275 [iot_thread] [INFO ][Shadow][12750] (ESP_246F2825D19C) Adding new UPDATED callback.
56 1275 [iot_thread] [INFO ][MQTT][12750] (MQTT connection 0x3ffb9b9c) SUBSCRIBE operation scheduled.
57 1275 [iot_thread] [INFO ][MQTT][12750] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffb9cb8) Waiting for operation completion.
58 1295 [iot_thread] [INFO ][MQTT][12950] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffb9cb8) Wait complete with result SUCCESS.
59 1295 [iot_thread] [INFO ][Shadow][12950] (ESP_246F2825D19C) Shadow UPDATED callback operation complete with result SUCCESS.
60 1295 [iot_thread] [INFO ][MQTT][12950] MQTT library successfully initialized.
61 1295 [iot_thread] [INFO ][Shadow][12950] Shadow library successfully initialized.
62 1296 [iot_thread] [INFO ][MQTT][12960] (MQTT connection 0x3ffb9b9c) SUBSCRIBE operation scheduled.
63 1296 [iot_thread] [INFO ][MQTT][12960] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffba020) Waiting for operation completion.
64 1326 [iot_thread] [INFO ][MQTT][13260] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffba020) Wait complete with result SUCCESS.
65 1326 [iot_thread] [INFO ][MQTT][13260] (MQTT connection 0x3ffb9b9c) SUBSCRIBE operation scheduled.
66 1326 [iot_thread] [INFO ][MQTT][13260] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffb9cb8) Waiting for operation completion.
67 1357 [iot_thread] [INFO ][MQTT][13560] (MQTT connection 0x3ffb9b9c, SUBSCRIBE operation 0x3ffb9cb8) Wait complete with result SUCCESS.
68 1357 [iot_thread] [INFO ][MQTT][13570] (MQTT connection 0x3ffb9b9c) MQTT PUBLISH operation queued.
69 1396 [iot_thread] [INFO ][DEMO][13960] ESP_246F2825D19C changing state from 0 to 0.
70 1396 [iot_thread] [INFO ][MQTT][13960] (MQTT connection 0x3ffb9b9c) MQTT PUBLISH operation queued.
71 1396 [iot_thread] [INFO ][DEMO][13960] ESP_246F2825D19C sent new state report.
72 1429 [iot_thread] [INFO ][DEMO][14290] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0,"otajobflag":1},"reported":{"switch_1":0,"swi73 1430 [iot_thread] [INFO ][Shadow][14300] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
74 1451 [iot_thread] [INFO ][DEMO][14510] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0,"otajobflag":0},"reported":{"switch_1":0,"swi75 1469 [iot_thread] [INFO ][Shadow][14690] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
76 2566 [iot_thread] [INFO ][DEMO][25660] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0,"otajobflag":0},"reported":{"switch_1":0,"swi77 2586 [iot_thread] [WARN ][Shadow][25860] Shadow UPDATE callback received an unknown operation.
78 2586 [iot_thread] [INFO ][DEMO][25860] ESP_246F2825D19C changing state from 0 to 1.
79 2587 [iot_thread] [INFO ][MQTT][25870] (MQTT connection 0x3ffb9b9c) MQTT PUBLISH operation queued.
80 2587 [iot_thread] [INFO ][DEMO][25870] ESP_246F2825D19C sent new state report.
81 2587 [iot_thread] [INFO ][MQTT][25870] MQTT library successfully initialized.
82 2587 [iot_thread] OTA demo version 1.0.0
83 2587 [iot_thread] Creating MQTT Client...
84 2624 [wifi] Heap: current 36232 lowest 36132
85 2624 [IP-task] Heap: current 37160 lowest 37060
86 2625 [IP-task] Heap: current 36752 lowest 35232
87 2626 [iot_thread] [INFO ][Shadow][26260] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
88 2626 [iot_thread] [INFO ][DEMO][26260] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0,"otajobflag":1},"reported":{"switch_1":0,"swi89 2646 [wifi] Heap: current 35452 lowest 35216
90 2646 [wifi] Heap: current 35384 lowest 35020
91 2646 [wifi] Heap: current 35336 lowest 34268
92 2646 [wifi] Heap: current 35288 lowest 34220
93 2646 [IP-task] Heap: current 32364 lowest 32128
94 2647 [IP-task] Heap: current 32940 lowest 31932
95 2723 [IP-task] Heap: current 21156 lowest 20292
96 2748 [wifi] Heap: current 20280 lowest 20216
97 2748 [wifi] Heap: current 21588 lowest 19932
98 2769 [wifi] Heap: current 21304 lowest 19856
99 2800 [wifi] Heap: current 9320 lowest 9264
100 2800 [wifi] Heap: current 9124 lowest 8820
101 2902 [wifi] Heap: current 13124 lowest 8784
102 3035 [wifi] Heap: current 5640 lowest 5584
103 3096 [wifi] Heap: current 5224 lowest 5140
104 3107 [wifi] Heap: current 5224 lowest 4884
246F2825D19C
thing_name:ESP_246F2825D19C
105 3160 [iot_thread] Connecting to broker...
106 3160 [iot_thread] printing mac address:107 3160 [iot_thread] [INFO ][MQTT][31600] Establishing new MQTT connection.
108 3160 [iot_thread] [INFO ][MQTT][31600] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
109 3160 [iot_thread] [INFO ][MQTT][31600] (MQTT connection 0x3ffd7e28, CONNECT operation 0x3ffd9cfc) Waiting for operation completion.
110 3189 [iot_thread] [INFO ][MQTT][31890] (MQTT connection 0x3ffd7e28, CONNECT operation 0x3ffd9cfc) Wait complete with result SUCCESS.
111 3189 [iot_thread] [INFO ][MQTT][31890] New MQTT connection 0x3ffbf78c established.
112 3189 [iot_thread] Connected to broker.
113 3191 [iot_thread] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
114 3192 [iot_thread] [OTA_AgentInit_internal] Failed to start the OTA Task, Error Code :ffffffff  Queue:00000000
115 3192 [iot_thread] [INFO ][MQTT][31920] (MQTT connection 0x3ffd7e28) Disconnecting connection.
116 3192 [iot_thread] [INFO ][MQTT][31920] (MQTT connection 0x3ffd7e28, DISCONNECT operation 0x3ffd9cfc) Waiting for operation completion.
117 3195 [iot_thread] [INFO ][MQTT][31950] (MQTT connection 0x3ffd7e28, DISCONNECT operation 0x3ffd9cfc) Wait complete with result SUCCESS.
118 3195 [iot_thread] [INFO ][MQTT][31950] (MQTT connection 0x3ffd7e28) Connection disconnected.
119 3196 [iot_thread] [INFO ][MQTT][31960] (MQTT connection 0x3ffd7e28) Network connection closed.
246F2825D19C
thing_name:ESP_246F2825D19C
120 3886 [iot_thread] Connecting to broker...
121 3886 [iot_thread] printing mac address:122 3886 [iot_thread] [INFO ][MQTT][38860] Establishing new MQTT connection.
123 3886 [iot_thread] [INFO ][MQTT][38860] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
124 3886 [iot_thread] [INFO ][MQTT][38860] (MQTT connection 0x3ffd8fd0, CONNECT operation 0x3ffd90ec) Waiting for operation completion.
246F2825D19C
thing_name:ESP_246F2825D19C
125 3917 [iot_thread] [INFO ][MQTT][39170] (MQTT connection 0x3ffd8fd0, CONNECT operation 0x3ffd90ec) Wait complete with result SUCCESS.
126 3917 [iot_thread] [INFO ][MQTT][39170] New MQTT connection 0x3ffbf78c established.
127 3917 [iot_thread] Connected to broker.
128 3917 [iot_thread] printing mac address:129 3917 [iot_thread] [OTA_AgentInit_internal] Failed to start the OTA Task, Error Code :ffffffff  Queue:00000000
130 3917 [iot_thread] [INFO ][MQTT][39170] (MQTT connection 0x3ffd8fd0) Disconnecting connection.
131 3917 [iot_thread] [INFO ][MQTT][39170] (MQTT connection 0x3ffd8fd0, DISCONNECT operation 0x3ffd8d18) Waiting for operation completion.
132 3920 [iot_thread] [INFO ][MQTT][39200] (MQTT connection 0x3ffd8fd0, DISCONNECT operation 0x3ffd8d18) Wait complete with result SUCCESS.
133 3920 [iot_thread] [INFO ][MQTT][39200] (MQTT connection 0x3ffd8fd0) Connection disconnected.
134 3921 [iot_thread] [INFO ][MQTT][39210] (MQTT connection 0x3ffd8fd0) Network connection closed.

look like  below line is doing something
114 3192 [iot_thread] [OTA_AgentInit_internal] Failed to start the OTA Task, Error Code :ffffffff Queue:00000000

@yanjos-dev  thanks it was connection problem with mqtt not i am able to run both mqtt and shadow together with different client ID  thank you

it was worked only once
I (6895) PKCS11: Initializing NVS partition: "storage"
28 670 [IP-task] Heap: current 76536 lowest 76292
29 687 [IP-task] Heap: current 45460 lowest 45324
30 688 [wifi] Heap: current 44640 lowest 44504
31 688 [wifi] Heap: current 44356 lowest 44220
32 688 [IP-task] Heap: current 41948 lowest 41812
33 688 [wifi] Heap: current 41408 lowest 41272
34 688 [IP-task] Heap: current 41948 lowest 40304
35 708 [wifi] Heap: current 37624 lowest 37488
36 708 [IP-task] Heap: current 38532 lowest 36520
37 757 [wifi] Heap: current 25160 lowest 25092
38 757 [wifi] Heap: current 26568 lowest 24808
39 808 [wifi] Heap: current 24608 lowest 24580
40 809 [wifi] Heap: current 24324 lowest 24296
41 809 [wifi] Heap: current 25632 lowest 24012
42 829 [wifi] Heap: current 14800 lowest 14772
43 839 [wifi] Heap: current 20972 lowest 14488
44 1044 [wifi] Heap: current 10672 lowest 10652
45 1054 [wifi] Heap: current 10672 lowest 10368
46 1095 [wifi] Heap: current 10260 lowest 10208
47 1115 [wifi] Heap: current 10260 lowest 9796
48 1169 [IP-task] Heap: current 4748 lowest 4232
49 1170 [wifi] Heap: current 5100 lowest 3104
50 1170 [iot_thread] [INFO ][MQTT][11700] Establishing new MQTT connection.
51 1171 [iot_thread] [ERROR][NET][11710] Failed to create network receive task.
52 1171 [iot_thread] [ERROR][MQTT][11710] Failed to set MQTT network receive callback.
53 1171 [iot_thread] [ERROR][MQTT][11710] Failed to establish new MQTT connection, error NETWORK ERROR.
54 1171 [iot_thread] [INFO ][MQTT][11710] Network connection closed on error.
55 1172 [iot_thread] [INFO ][MQTT][11720] (MQTT connection 0x3ffd84b4) Network connection destroyed.
56 1172 [iot_thread] [ERROR][DEMO][11720] MQTT CONNECT returned error NETWORK ERROR.
57 1173 [iot_thread] [INFO ][DEMO][11730] Shadow Thing Name is ESP_246F2825D19C (length 16).
58 1376 [iot_thread] ERROR: �%shake failed with error code -16
59 1376 [iot_thread] [ERROR][NET][13760] Failed to establish new connection. Socket status: -1002.
60 1377 [iot_thread] [ERROR][MQTT][13770] Failed to establish new MQTT connection, error NETWORK ERROR.
61 1377 [iot_thread] [ERROR][DEMO][13770] MQTT CONNECT returned error NETWORK ERROR.
62 1378 [iot_thread] [INFO ][DEMO][13780] Shadow Thing Name is ESP_246F2825D19C (length 16).
63 1379 [IP-task] Heap: current 55216 lowest 1160
64 1591 [iot_thread] ERROR: Handshake failed with error code -16
65 1591 [iot_thread] [ERROR][NET][15910] Failed to establish new connection. Socket status: -1002.
66 1591 [iot_thread] [ERROR][MQTT][15910] Failed to establish new MQTT connection, error NETWORK ERROR.
67 1591 [iot_thread] [ERROR][DEMO][15910] MQTT CONNECT returned error NETWORK ERROR.
68 1592 [iot_thread] [INFO ][DEMO][15920] Shadow Thing Name is ESP_246F2825D19C (length 16).
69 1722 [iot_thread] ERROR: Handshake failed with error code -9984
70 1722 [iot_thread] [ERROR][NET][17220] Failed to establish new connection. Socket status: -1002.
71 1723 [iot_thread] [ERROR][MQTT][17230] Failed to establish new MQTT connection, error NETWORK ERROR.
72 1723 [iot_thread] [ERROR][DEMO][17230] MQTT CONNECT returned error NETWORK ERROR.
73 1724 [iot_thread] [INFO ][DEMO][17240] Shadow Thing Name is ESP_246F2825D19C (length 16).
74 1930 [iot_thread] ERROR: Handshake failed with error code -16
75 1930 [iot_thread] [ERROR][NET][19300] Failed to establish new connection. Socket status: -1002.
76 1930 [iot_thread] [ERROR][MQTT][19300] Failed to establish new MQTT connection, error NETWORK ERROR.
77 1930 [iot_thread] [ERROR][DEMO][19300] MQTT CONNECT returned error NETWORK ERROR.
78 1931 [iot_thread] [INFO ][DEMO][19310] Shadow Thing Name is ESP_246F2825D19C (length 16).
79 1932 [IP-task] Heap: current 52144 lowest 1092
80 1934 [main] Connecting to broker...
81 1934 [main] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
82 1934 [main] [INFO ][MQTT][19340] Establishing new MQTT connection.
83 1935 [main] [INFO ][MQTT][19350] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
84 1937 [main] [INFO ][MQTT][19370] (MQTT connection 0x3ffd8648, CONNECT operation 0x3ffd9fec) Waiting for operation completion.
85 1975 [main] [INFO ][MQTT][19740] (MQTT connection 0x3ffd8648, CONNECT operation 0x3ffd9fec) Wait complete with result SUCCESS.
86 1975 [main] [INFO ][MQTT][19750] New MQTT connection 0x3ffbf65c established.
87 1975 [main] Connected to broker.
88 1976 [main] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
89 1976 [main] [OTA_AgentInit_internal] OTA Task is Ready.
90 1977 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [Ready] Event [Start] New state [RequestingJob]
91 1977 [OTA Agent Task] [INFO ][MQTT][19770] (MQTT connection 0x3ffd8648) SUBSCRIBE operation scheduled.
92 1977 [OTA Agent Task] [INFO ][MQTT][19770] (MQTT connection 0x3ffd8648, SUBSCRIBE operation 0x3ffd9fec) Waiting for operation completion.
93 1997 [OTA Agent Task] [INFO ][MQTT][19970] (MQTT connection 0x3ffd8648, SUBSCRIBE operation 0x3ffd9fec) Wait complete with result SUCCESS.
94 1997 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/$next/get/accepted
95 1999 [OTA Agent Task] [INFO ][MQTT][19990] (MQTT connection 0x3ffd8648) SUBSCRIBE operation scheduled.
96 1999 [OTA Agent Task] [INFO ][MQTT][19990] (MQTT connection 0x3ffd8648, SUBSCRIBE operation 0x3ffd9fec) Waiting for operation completion.
97 2017 [OTA Agent Task] [INFO ][MQTT][20170] (MQTT connection 0x3ffd8648, SUBSCRIBE operation 0x3ffd9fec) Wait complete with result SUCCESS.
98 2017 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/notify-next
99 2017 [OTA Agent Task] [prvRequestJob_Mqtt] Request #0
100 2019 [OTA Agent Task] [INFO ][MQTT][20190] (MQTT connection 0x3ffd8648) MQTT PUBLISH operation queued.
101 2019 [OTA Agent Task] [INFO ][MQTT][20190] (MQTT connection 0x3ffd8648, PUBLISH operation 0x3ffd9fec) Waiting for operation completion.
102 2038 [OTA Agent Task] [INFO ][MQTT][20380] (MQTT connection 0x3ffd8648, PUBLISH operation 0x3ffd9fec) Wait complete with result SUCCESS.
103 2038 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [RequestingJob] Event [RequestJobDocument] New state [WaitingForJob]
I (20735) ota_pal: prvPAL_SetPlatformImageState, 4
W (20735) ota_pal: Set image as aborted!
I (20745) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (20745) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
W (20755) ota_pal: Image not in self test mode 2
I (20755) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (20765) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
104 2040 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
105 2040 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
106 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: execution
107 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobId
108 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobDocument
109 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: afr_ota
110 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: protocols
111 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: files
112 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filepath
113 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filesize
114 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: fileid
115 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: certfile
116 2040 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: sig-sha256-ecdsa
117 2040 [OTA Agent Task] [prvDefaultCustomJobCallback] Received Custom Job inside OTA Agent which is not supported.
118 2040 [OTA Agent Task] [prvParseJobDoc] Ignoring job without ID.
119 2040 [OTA Agent Task] [prvOTA_Close] Context->0x0x3ffec590
120 2044 [OTA Agent Task] [prvOTAAgentTask] Handler failed. Current State [WaitingForJob] Event  [ReceivedJobDocument] Error Code [603979776]
121 2146 [iot_thread] ERROR: Handshake failed with error code -16
122 2146 [iot_thread] [ERROR][NET][21460] Failed to establish new connection. Socket status: -1002.
123 2147 [iot_thread] [ERROR][MQTT][21470] Failed to establish new MQTT connection, error NETWORK ERROR.
124 2147 [iot_thread] [ERROR][DEMO][21470] MQTT CONNECT returned error NETWORK ERROR.
125 2148 [iot_thread] [INFO ][DEMO][21480] Shadow Thing Name is ESP_246F2825D19C (length 16).
126 2149 [main] State: RequestingJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
127 2250 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
128 2361 [iot_thread] ERROR: Handshake failed with error code -16
129 2362 [iot_thread] [ERROR][NET][23620] Failed to establish new connection. Socket status: -1002.
130 2362 [iot_thread] [ERROR][MQTT][23620] Failed to establish new MQTT connection, error NETWORK ERROR.
131 2362 [iot_thread] [ERROR][DEMO][23620] MQTT CONNECT returned error NETWORK ERROR.
132 2363 [iot_thread] [INFO ][DEMO][23630] Shadow Thing Name is ESP_246F2825D19C (length 16).
133 2364 [IP-task] Heap: current 57744 lowest 948
134 2365 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
135 2466 [main] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0

You are not telling what platform you are using? But as I see "ESP_246F2825D19C", I assume it is an ESP32?
> 49 1170 [wifi] Heap: current 5100 lowest 3104
> 51 1171 [iot_thread] [ERROR][NET][11710] Failed to create network receive task.

It looks like it is running out of heap space.
I recently investigated the usage of RAM in the ESP demo project, and I made recommendations to lower the RAM foot-print.
Please have a look here

@htibosch i am using esp32 for two demos one is shadow and another one is OTA i just want to run both demo,
yes esp32 is running out of heap space that way i just made separate calls for both demo first i initialize shadow demo ones its initialization complete i am initiating OTA demo but  i am getting error like below
2695 [OTA_task] mbedTLS sign failed with error -17168
86 2696 [OTA_task] ERROR: Failure in signing callback: 6
87 2696 [OTA_task] ERROR: Handshake failed with error code -2003
88 2696 [OTA_task] [ERROR][NET][26960] Failed to establish new connection. Socket status: -1002.
89 2696 [OTA_task] Network Connection failed, retry delay 5000 ms, retries left 100
90 3638 [wifi] Heap: current 1980 lowest 1628
91 3645 [OTA_task] mbedTLS sign failed with error -17168
92 3645 [OTA_task] ERROR: Failure in signing callback: 6
93 3645 [OTA_task] ERROR: Handshake failed with error code -2003
94 3645 [OTA_task] [ERROR][NET][36450] Failed to establish new connection. Socket status: -1002.
95 3645 [OTA_task] Network Connection failed, retry delay 5000 ms, retries left 99
96 3659 [wifi] Heap: current 59668 lowest 1600

@htibosch  i was successful with ota and shadow demo but when i am using IRAM_ATTR handler and  interrupts and my shadow size also increases so this all above logs are happens ,
when i calls both demo same time in app_main stack overflow happens for preventing this i have created separate task in shadow demo which call ota demo once it running ok but tls handshake fails

@htibosch  as you mention i saw again yes i am running out of heap so is there any chance to resolve this issue

Have you already changed you copy of FreeRTOSIPConfig.h ?
After changing, rebuild the whole project and check if the heap logging changes, there should be more heap available.
+#define ipconfigIP_TASK_STACK_SIZE_WORDS   ( configMINIMAL_STACK_SIZE * 3 )

For me this worked fine, but make sure you don't get a stack overflow.

now reducing size help me little bit but still running out of heap and also even i mange to run both demo are they perform their operations  below are logs
24 1146 [iot_thread] [INFO ][MQTT][11460] MQTT library successfully initialized.
25 1146 [iot_thread] [INFO ][Shadow][11460] Shadow library successfully initialized.
26 1147 [iot_thread] [INFO ][DEMO][11470] Shadow Thing Name is ESP_246F2825D19C (length 16).
27 1148 [IP-task] Heap: current 103996 lowest 103920
28 1173 [wifi] Heap: current 123332 lowest 103724
29 1173 [iot_thread] DNS[0xD69B]: The answer to 'xxxxxxxxxxxxxx-ats.iot.eu-west-1.amazonaws.com' (22f8a986ip) will be stored
30 1174 [IP-task] Heap: current 109572 lowest 92688
I (12285) PKCS11: Initializing NVS partition: "storage"
31 1210 [IP-task] Heap: current 76048 lowest 75464
32 1213 [wifi] Heap: current 75228 lowest 73768
33 1234 [IP-task] Heap: current 72936 lowest 72436
34 1235 [wifi] Heap: current 72012 lowest 70740
35 1255 [wifi] Heap: current 72200 lowest 70552
36 1326 [wifi] Heap: current 68740 lowest 67348
37 1377 [wifi] Heap: current 67044 lowest 65652
38 1423 [IP-task] Heap: current 59820 lowest 58600
39 1459 [wifi] Heap: current 58704 lowest 58348
40 1459 [IP-task] Heap: current 59420 lowest 57824
41 1490 [wifi] Heap: current 53960 lowest 52352
42 1500 [wifi] Heap: current 54100 lowest 49472
43 1674 [wifi] Heap: current 48904 lowest 48828
44 1695 [wifi] Heap: current 50380 lowest 48400
45 1766 [wifi] Heap: current 43868 lowest 43808
46 1797 [wifi] Heap: current 43868 lowest 43524
47 1849 [iot_thread] [INFO ][MQTT][18490] Establishing new MQTT connection.
48 1849 [iot_thread] [INFO ][MQTT][18490] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
49 1849 [iot_thread] [INFO ][MQTT][18490] (MQTT connection 0x3ffb40ec, CONNECT operation 0x3ffb6090) Waiting for operation completion.
50 1873 [iot_thread] [INFO ][MQTT][18730] (MQTT connection 0x3ffb40ec, CONNECT operation 0x3ffb6090) Wait complete with result SUCCESS.
51 1873 [iot_thread] [INFO ][MQTT][18730] New MQTT connection 0x3ffb3e10 established.
52 1873 [iot_thread] [INFO ][Shadow][18730] (ESP_246F2825D19C) Modifying Shadow DELTA callback.
53 1873 [iot_thread] [INFO ][Shadow][18730] (ESP_246F2825D19C) Adding new DELTA callback.
54 1873 [iot_thread] [INFO ][MQTT][18730] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
55 1874 [iot_thread] [INFO ][MQTT][18730] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffd8c30) Waiting for operation completion.
56 1901 [iot_thread] [INFO ][MQTT][19010] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffd8c30) Wait complete with result SUCCESS.
57 1901 [iot_thread] [INFO ][Shadow][19010] (ESP_246F2825D19C) Shadow DELTA callback operation complete with result SUCCESS.
58 1901 [iot_thread] [INFO ][Shadow][19010] (ESP_246F2825D19C) Modifying Shadow UPDATED callback.
59 1901 [iot_thread] [INFO ][Shadow][19010] (ESP_246F2825D19C) Adding new UPDATED callback.
60 1902 [iot_thread] [INFO ][MQTT][19020] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
61 1902 [iot_thread] [INFO ][MQTT][19020] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb5e6c) Waiting for operation completion.
62 1931 [iot_thread] [INFO ][MQTT][19310] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb5e6c) Wait complete with result SUCCESS.
63 1931 [iot_thread] [INFO ][Shadow][19310] (ESP_246F2825D19C) Shadow UPDATED callback operation complete with result SUCCESS.
64 1931 [iot_thread] [INFO ][MQTT][19310] MQTT library successfully initialized.
65 1932 [iot_thread] [INFO ][Shadow][19320] Shadow library successfully initialized.
66 1932 [iot_thread] [INFO ][MQTT][19320] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
67 1932 [iot_thread] [INFO ][MQTT][19320] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffd8c30) Waiting for operation completion.
68 1962 [iot_thread] [INFO ][MQTT][19620] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffd8c30) Wait complete with result SUCCESS.
69 1962 [iot_thread] [INFO ][MQTT][19620] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
70 1962 [iot_thread] [INFO ][MQTT][19620] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6108) Waiting for operation completion.
71 1992 [iot_thread] [INFO ][MQTT][19920] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6108) Wait complete with result SUCCESS.
72 1992 [iot_thread] [INFO ][MQTT][19920] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
73 2023 [iot_thread] [INFO ][Shadow][20230] Shadow DELETE of ESP_246F2825D19C was ACCEPTED.
74 2023 [iot_thread] [INFO ][MQTT][20230] (MQTT connection 0x3ffb40ec) UNSUBSCRIBE operation scheduled.
75 2023 [iot_thread] [INFO ][MQTT][20230] (MQTT connection 0x3ffb40ec, UNSUBSCRIBE operation 0x3ffb9dcc) Waiting for operation completion.
76 2074 [iot_thread] [INFO ][MQTT][20740] (MQTT connection 0x3ffb40ec, UNSUBSCRIBE operation 0x3ffb9dcc) Wait complete with result SUCCESS.
77 2074 [iot_thread] [INFO ][MQTT][20740] (MQTT connection 0x3ffb40ec) UNSUBSCRIBE operation scheduled.
78 2074 [iot_thread] [INFO ][MQTT][20740] (MQTT connection 0x3ffb40ec, UNSUBSCRIBE operation 0x3ffb9b9c) Waiting for operation completion.
79 2105 [iot_thread] [INFO ][MQTT][21050] (MQTT connection 0x3ffb40ec, UNSUBSCRIBE operation 0x3ffb9b9c) Wait complete with result SUCCESS.
80 2105 [iot_thread] [INFO ][DEMO][21050] Successfully cleared Shadow of ESP_246F2825D19C.
81 2106 [iot_thread] [INFO ][MQTT][21050] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
82 2106 [iot_thread] [INFO ][MQTT][21060] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9b9c) Waiting for operation completion.
83 2136 [iot_thread] [INFO ][MQTT][21360] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb9b9c) Wait complete with result SUCCESS.
84 2137 [iot_thread] [INFO ][MQTT][21370] (MQTT connection 0x3ffb40ec) SUBSCRIBE operation scheduled.
85 2137 [iot_thread] [INFO ][MQTT][21370] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6108) Waiting for operation completion.
86 2167 [iot_thread] [INFO ][MQTT][21670] (MQTT connection 0x3ffb40ec, SUBSCRIBE operation 0x3ffb6108) Wait complete with result SUCCESS.
87 2167 [iot_thread] [INFO ][MQTT][21670] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
88 2198 [iot_thread] [INFO ][DEMO][21980] ESP_246F2825D19C changing state from 0 to 0.
89 2198 [iot_thread] [INFO ][DEMO][21980] ESP_246F2825D19C changing state from 0 to 0.
90 2198 [iot_thread] [INFO ][DEMO][21980] ESP_246F2825D19C changing state from 0 to 0.
91 2198 [iot_thread] [INFO ][DEMO][21980] ESP_246F2825D19C changing state from 0 to 1.
92 2198 [iot_thread] [INFO ][DEMO][21980] ESP_246F2825D19C changing state from 1 to 0.
93 2199 [iot_thread] [INFO ][MQTT][21990] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.
94 2199 [iot_thread] [INFO ][DEMO][21990] ESP_246F2825D19C sent new state report.
95 2203 [iot_thread] [INFO ][Shadow][22030] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
96 2204 [iot_thread] [INFO ][DEMO][22040] Shadow was updated!
Previous: {"state":{}}
Current:  {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":1,"otajobflag":0}}}
97 2238 [iot_thread] [INFO ][Shadow][22380] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
98 2259 [iot_thread] [INFO ][DEMO][22590] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":1,"otajobflag":0}}}
Current:  {"state":{"desirHeap summary for capabilities 0x00001000:
  At 0x3ffb2730 len 15448 free 352 allocated 14928 min_free 0
    largest_free_block 192 alloc_blocks 29 free_blocks 5 total_blocks 34
  At 0x3ffaff10 len 240 free 0 allocated 172 min_free 0
    largest_free_block 0 alloc_blocks 9 free_blocks 0 total_blocks 9
  At 0x3ffb6388 len 7288 free 0 allocated 7172 min_free 0
    largest_free_block 0 alloc_blocks 21 free_blocks 0 total_blocks 21
  At 0x3ffb9a20 len 16648 free 988 allocated 15268 min_free 0
    largest_free_block 584 alloc_blocks 82 free_blocks 8 total_blocks 90
  At 0x3ffd0340 len 64704 free 10036 allocated 54396 min_free 4
    largest_free_block 4144 alloc_blocks 53 free_blocks 7 total_blocks 60
  At 0x3ffe0440 len 129984 free 52828 allocated 76632 min_free 43520
    largest_free_block 42300 alloc_blocks 96 free_blocks 27 total_blocks 123
  Totals:
    free 64204 allocated 168568 min_free 43524 largest_free_block 42300
99 4153 [OTA_task] [INFO ][MQTT][41530] MQTT library successfully initialized.
100 4153 [OTA_task] OTA demo version 1.0.0
101 4153 [OTA_task] Creating MQTT Client...
102 4201 [IP-task] Heap: current 31460 lowest 31228
103 4224 [wifi] Heap: current 30640 lowest 30408
104 4224 [wifi] Heap: current 30640 lowest 30212
105 4224 [wifi] Heap: current 30640 lowest 30128
106 4238 [wifi] Heap: current 30276 lowest 30044
107 4238 [wifi] Heap: current 30216 lowest 29764
108 4238 [wifi] Heap: current 30168 lowest 29016
109 4239 [IP-task] Heap: current 26984 lowest 26752
110 4239 [IP-task] Heap: current 27372 lowest 26556
111 4269 [wifi] Heap: current 27616 lowest 26464
112 4269 [IP-task] Heap: current 27376 lowest 26416
113 4347 [wifi] Heap: current 25792 lowest 25560
114 4347 [wifi] Heap: current 27204 lowest 25280
115 4350 [wifi] Heap: current 17516 lowest 15212
116 4358 [wifi] Heap: current 15876 lowest 15052
117 4363 [IP-task] Heap: current 15304 lowest 14380
118 4377 [wifi] Heap: current 14480 lowest 14288
119 4388 [wifi] Heap: current 15884 lowest 13928
120 4429 [wifi] Heap: current 13056 lowest 12940
121 4439 [wifi] Heap: current 3392 lowest 3276
122 4449 [wifi] Heap: current 9792 lowest 2992
123 4665 [OTA_task] mbedTLS sign failed with error -17168
124 4665 [OTA_task] ERROR: Failure in signing callback: 6
125 4665 [OTA_task] ERROR: Handshake failed with error code -2003
126 4666 [OTA_task] [ERROR][NET][46660] Failed to establish new connection. Socket status: -1002.
127 4667 [OTA_task] Network Connection failed, retry delay 5000 ms, retries left 100
128 4726 [wifi] Heap: current 62396 lowest 1804
129 5408 [iot_thread] [INFO ][MQTT][54080] (MQTT connection 0x3ffb40ec) MQTT PUBLISH operation queued.

@htibosch  @yanjos-dev  after some time later it got connected but when i try to perform shadow operation it show that connection closed mean that ota demo still killing shadow demo

@htibosch  i follow given link and i am successfully connected to both demo but when i am performing shadow action it  failed to send below are the logs and thanks for the above help ;)
202 6791 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
203 6891 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
204 6991 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
205 7087 [iot_thread] [INFO ][MQTT][70870] (MQTT connection 0x3ffb5fa8) MQTT PUBLISH operation queued.
206 7087 [iot_thread] [ERROR][NET][70870] Error -27648 while sending data.
207 7091 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
208 7191 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
209 7291 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
210 7391 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0
211 7398 [iot_thread] [ERROR][NET][73980] Error -27648 while sending data.
212 7398 [iot_thread] [ERROR][MQTT][73980] (MQTT connection 0x3ffb5fa8) Failed to send PINGREQ.
213 7398 [iot_thread] [WARN ][NET][73980] Failed to close connection.
214 7398 [iot_thread] [INFO ][MQTT][73980] (MQTT connection 0x3ffb5fa8) Network connection closed.
215 7491 [OTA_task] State: WaitingForJob  Received: 2   Queued: 0   Processed: 0   Dropped: 0

I have pointed out how you can reduce the consumption of RAM in the FreeRTOS+TCP library by changing the configuration in FreeRTOSIPConfig.h.
It is also useful to define configUSE_MALLOC_FAILED_HOOK in your FreeRTOSConfig.h, and also define this call-back, usually in main.c:
#if( configUSE_MALLOC_FAILED_HOOK != 0 )
    void vApplicationMallocFailedHook( void )
    {
        taskDISABLE_INTERRUPTS();
        {
            for( ;; )
            {
                /* Put a break on the next instruction. */
                portNOP();
            }
        }
        /* Will never reach here. */
        taskENABLE_INTERRUPTS();
    }
#endif /* ( configUSE_MALLOC_FAILED_HOOK != 0 ) */

I don't know what to think of the above logging. Error -27648 doesn't sound like a valid errno.

@htibosch  yes consumption of RAM is reduced with your changes  thanks for the valuable information really appreciated,
but above logs are just showing that their is still not enough space to send shadow update

and after connection established to ota, shadow pingrep fail

@ravibhagavandas is there any solution for this issues

Hello @sameerdasarwad,
You should able to make use of shared MQTT connection to reduce heap usage. OTA and Shadow libraries both take reference to an MQTT connection. In your current implementation, you are creating two separate MQTT connections.
Instead of calling two demo function, you would create an MQTT connection and then pass it to the OTA and Shadow libraries.
You can use code from _establishMqttConnection() in shadow demo code to create the shared connection. Once the connection is successfully established, pass the created connection to the shadow task and to the OTA task.
You will need to change demo code to make use of the shared connection. For example, in RunShadowDemo() you would remove code that calls _establishMqttConnection() instead would use shared MQTT connection.  Similarly, in vRunOTAUpdateDemo() you would remove MQTT connection logic and assign xConnection.xMqttConnection to the shared MQTT connection.
Please note, at this time we do not have a working example to demonstrate use of shared MQTT connection. We shall try to create a proof of concept showing use of shared MQTT connection, but meanwhile you can give it a try and let us know if that works or you have any question.
Thanks.

@abhidixi11  thanks for valuable information i will give try on sharing connection might be it will works

Hi @sameerdasarwad As you are running out of heap memory, can you try building the example using LwIP networking stack?
Memory consumption of LwIP stack is significantly low as compared to FreeRTOS TCP stack.
To build using LwIP stack, run command cmake -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -S . -B build -DAFR_ESP_LWIP=1

@shubhamkulkarni97  i am using make so is there any other command

@abhidixi11  i have given try to use shared mqttconnection but still facing same issues of low heap while sending shadow payload and downloading ota image

@shubhamkulkarni97 i am using make so is there any other command

set the environment variable AFR_ESP_LWIP using export AFR_ESP_LWIP=1 and the build using make

Thanks @sameerdasarwad  Can you please send logs after you have changed code to use shared MQTT connection? I'm assuming that you did make some progress but got stuck in middle of doing OTA.  Thanks.

@abhidixi11  thank you so much for good idea and encouragement i successfull run both demo but after download ota job failed below are the logs
`1099 17897 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [ReceivedFileBlock] New state [WaitingForFileBlock]
1100 17958 [OTA Agent Task] [prvIngestDataBlock] Received file block 239, size 4096
1101 17958 [OTA Agent Task] [prvIngestDataBlock] Remaining: 3
1102 17958 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [ReceivedFileBlock] New state [WaitingForFileBlock]
1103 17960 [OTA Agent Task] [INFO ][MQTT][179580] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
1104 17960 [OTA Agent Task] [prvRequestFileBlock_Mqtt] OK: $aws/things/ESP_246F2825D19C/streams/AFR_OTA-0e68aa19-5e9b-4d72-b15d-4a3857fd615b/get/cbor
1105 17960 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [RequestFileBlock] New state [WaitingForFileBlock]
1106 17966 [iot_thread] State: WaitingForFileBlock  Received: 241   Queued: 0   Processed: 0   Dropped: 0
1107 18050 [OTA Agent Task] [prvIngestDataBlock] Received file block 240, size 4096
1108 18050 [OTA Agent Task] [prvIngestDataBlock] Remaining: 2
1109 18050 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [ReceivedFileBlock] New state [WaitingForFileBlock]
1110 18076 [iot_thread] State: WaitingForFileBlock  Received: 242   Queued: 0   Processed: 0   Dropped: 0
1111 18111 [OTA Agent Task] [prvIngestDataBlock] Received file block 241, size 4096
1112 18112 [OTA Agent Task] [prvIngestDataBlock] Remaining: 1
1113 18112 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [WaitingForFileBlock] Event [ReceivedFileBlock] New state [WaitingForFileBlock]
I (181856) ota_pal: No such certificate file: arn:aws:acm:eu-west-1:956711000280:certificate/aff86477-6fbc-4ffd-9cc9-766c3b75c5a2. Using aws_ota_codesigner_certificate.h.
1114 18152 [OTA Agent Task] [prvIngestDataBlock] Received file block 242, size 3120
1115 18152 [OTA Agent Task] [prvIngestDataBlock] Received final expected block of file.
1116 18152 [OTA Agent Task] [prvStopRequestTimer] Stopping request timer.
1117 18186 [iot_thread] State: WaitingForFileBlock  Received: 244   Queued: 0   Processed: 0   Dropped: 0
1118 18297 [iot_thread] State: WaitingForFileBlock  Received: 244   Queued: 0   Processed: 0   Dropped: 0
1119 18321 [OTA Agent Task] [prvIngestDataBlock] File receive complete and signature is valid.
1120 18321 [OTA Agent Task] [prvStopRequestTimer] Stopping request timer.
1121 18321 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] Msg: {"status":"IN_PROGRESS","statusDetails":{"self_test":"ready","updatedBy":"0x1000000"}}
1122 18323 [OTA Agent Task] [INFO ][MQTT][183210] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
1123 18323 [OTA Agent Task] [INFO ][MQTT][183230] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffd8ab4) Waiting for operation completion.
I (183796) boot_comm: chip revision: 1, min. application chip revision: 0
I (183796) esp_image: segment 0: paddr=0x001a0020 vaddr=0x3f400020 size=0x2835c (164700) map
1124 18346 [OTA Agent Task] [INFO ][MQTT][183460] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffd8ab4) Wait complete with result SUCCESS.
1125 18346 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] 'IN_PROGRESS' to $aws/things/ESP_246F2825D19C/jobs/AFR_OTA-final_test/update
1126 18346 [OTA Agent Task] Received eOTA_JobEvent_Activate callback from OTA Agent.
I (183946) esp_image: segment 1: paddr=0x001c8384 vaddr=0x3ffbdb60 size=0x034e4 ( 13540)
I (183966) esp_image: segment 2: paddr=0x001cb870 vaddr=0x40080000 size=0x00400 (  1024)
0x40080000: _WindowOverflow4 at /home/firewires/Desktop/esp/starboard/amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1685
I (183966) esp_image: segment 3: paddr=0x001cbc78 vaddr=0x40080400 size=0x04398 ( 17304)
I (183986) esp_image: segment 4: paddr=0x001d0018 vaddr=0x400d0018 size=0xb0488 (722056) map
0x400d0018: _flash_cache_start at ??:?
1127 18408 [iot_thread] State: WaitingForFileBlock  Received: 244   Queued: 0   Processed: 0   Dropped: 0
I (184546) esp_image: segment 5: paddr=0x002804a8 vaddr=0x40084798 size=0x12758 ( 75608)
0x40084798: set_chan_dig_gain at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_cal.c:2462 (discriminator 1)
I (184616) boot_comm: chip revision: 1, min. application chip revision: 0
I (184616) esp_image: segment 0: paddr=0x001a0020 vaddr=0x3f400020 size=0x2835c (164700) map
I (184746) esp_image: segment 1: paddr=0x001c8384 vaddr=0x3ffbdb60 size=0x034e4 ( 13540)
I (184756) esp_image: segment 2: paddr=0x001cb870 vaddr=0x40080000 size=0x00400 (  1024)
0x40080000: _WindowOverflow4 at /home/firewires/Desktop/esp/starboard/amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1685
I (184756) esp_image: segment 3: paddr=0x001cbc78 vaddr=0x40080400 size=0x04398 ( 17304)
I (184776) esp_image: segment 4: paddr=0x001d0018 vaddr=0x400d0018 size=0xb0488 (722056) map
0x400d0018: _flash_cache_start at ??:?
I (185346) esp_image: segment 5: paddr=0x002804a8 vaddr=0x40084798 size=0x12758 ( 75608)
0x40084798: set_chan_dig_gain at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_cal.c:2462 (discriminator 1)
1128 18519 [iot_thread] State: WaitingForFileBlock  Received: 244   Queued: 0   Processed: 0   Dropped: 0
I (185966) wifi: state: run -> init (0)
I (185966) wifi: pm stop, total sleep time: 102902826 us / 182212738 us
I (185966) wifi: new:<7,0>, old:<7,1>, ap:<255,255>, sta:<7,1>, prof:1
I (185966) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 8
I (185976) BTDM_INIT: BT controller compile version [9891bc6]
I (185986) wifi: flush txq
I (185986) wifi: stop sw txq
I (185986) wifi: lmac stop hw txq
I (185986) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (13) boot: ESP-IDF  2nd stage bootloader
I (13) boot: compile time 20:46:52
I (13) boot: Enabling RNG early entropy source...
I (16) boot: SPI Speed      : 40MHz
I (20) boot: SPI Mode       : DIO
I (24) boot: SPI Flash Size : 4MB
I (28) boot: Partition Table:
I (32) boot: ## Label            Usage          Type ST Offset   Length
I (39) boot:  0 nvs              WiFi data        01 02 00010000 00006000
I (46) boot:  1 otadata          OTA data         01 00 00016000 00002000
I (54) boot:  2 phy_init         RF data          01 01 00018000 00001000
I (61) boot:  3 ota_0            OTA app          00 10 00020000 00177000
I (69) boot:  4 ota_1            OTA app          00 11 001a0000 00177000
I (76) boot:  5 storage          WiFi data        01 02 00317000 00010000
I (84) boot: End of partition table
I (88) boot: otadata[1] is selected as new and marked PENDING_VERIFY state
I (140) boot: ota rollback check done
I (140) boot_comm: chip revision: 1, min. application chip revision: 0
I (140) esp_image: segment 0: paddr=0x001a0020 vaddr=0x3f400020 size=0x2835c (164700) map
I (207) esp_image: segment 1: paddr=0x001c8384 vaddr=0x3ffbdb60 size=0x034e4 ( 13540) load
I (212) esp_image: segment 2: paddr=0x001cb870 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/firewires/Desktop/esp/starboard/amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1685
I (214) esp_image: segment 3: paddr=0x001cbc78 vaddr=0x40080400 size=0x04398 ( 17304) load
I (230) esp_image: segment 4: paddr=0x001d0018 vaddr=0x400d0018 size=0xb0488 (722056) map
0x400d0018: _flash_cache_start at ??:?
I (485) esp_image: segment 5: paddr=0x002804a8 vaddr=0x40084798 size=0x12758 ( 75608) load
0x40084798: set_chan_dig_gain at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_cal.c:2462 (discriminator 1)
I (530) boot: Loaded app from partition at offset 0x1a0000
I (530) boot: Disabling RNG early entropy source...
I (530) cpu_start: Pro cpu up.
I (534) cpu_start: Application information:
I (539) cpu_start: Project name:     aws_demos
I (544) cpu_start: App version:      cd6e4a6-dirty
I (549) cpu_start: Compile time:     Feb 26 2020 00:01:13
I (555) cpu_start: ELF file SHA256:  4d0f043cd93371a1...
I (561) cpu_start: ESP-IDF:
I (566) cpu_start: Single core mode
I (570) heap_init: Initializing. RAM available for dynamic allocation:
I (577) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (583) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (589) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (595) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (601) heap_init: At 3FFCFCB8 len 00010348 (64 KiB): DRAM
I (608) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (614) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (620) heap_init: At 40096EF0 len 00009110 (36 KiB): IRAM
I (626) cpu_start: Pro cpu start user code
I (309) cpu_start: Starting scheduler on PRO CPU.
I (350) uart: queue free spaces: 10
0 2 [main] Initializing FreeRTOS TCP stack
printing current version 1.0.0
1 3 [iot_thread] [INFO ][DEMO][30] ---------STARTING DEMO---------
I (360) BTDM_INIT: BT controller compile version [9891bc6]
2 3 [iot_thread] [INFO ][INIT][30] SDK successfully initialized.
I (370) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (460) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
GAP procedure initiated: stop advertising.
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=187 adv_itvl_max=375
I (750) wifi: wifi driver task: 3ffba478, prio:23, stack:3584, core=0
I (750) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (750) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (770) wifi: wifi firmware version: c94f3e6
I (770) wifi: config NVS flash: enabled
I (770) wifi: config nano formating: disabled
I (770) wifi: Init dynamic tx buffer num: 32
I (780) wifi: Init data frame dynamic rx buffer num: 32
I (780) wifi: Init management frame dynamic rx buffer num: 32
I (790) wifi: Init management short buffer num: 32
I (790) wifi: Init static rx buffer size: 1600
I (800) wifi: Init static rx buffer num: 10
I (800) wifi: Init dynamic rx buffer num: 32
3 48 [iot_thread] [INFO ][DEMO][480] No networks connected for the demo. Waiting for a network connection.
I (820) wifi: mode : sta (24:6f:28:25:d1:9c)
I (820) WIFI: SYSTEM_EVENT_STA_START
I (1550) wifi: new:<7,1>, old:<1,0>, ap:<255,255>, sta:<7,1>, prof:1
I (2540) wifi: state: init -> auth (b0)
I (2550) wifi: state: auth -> assoc (0)
I (2560) wifi: state: assoc -> run (10)
I (2600) wifi: connected with FirewiresAct, channel 7, 40U, bssid = 98:da:c4:2a:44:1a
I (2600) wifi: pm start, type: 1
I (2600) WIFI: SYSTEM_EVENT_STA_CONNECTED
4 255 [wifi] Network buffers: 16 lowest 16
5 255 [wifi] Heap: current 119040 lowest 105964
246F2825D19C
thing_name:ESP_246F2825D19C
6 302 [IP-task] printing mac address:7 302 [IP-task] Network buffers: 15 lowest 15
246F2825D19C
thing_name:ESP_246F2825D19C
8 308 [IP-task] vDHCPProcess: offer ac141476ip
9 308 [IP-task] printing mac address:I (3500) event: sta ip: <IP_ADDRESS>, mask: <IP_ADDRESS>, gw: <IP_ADDRESS>
I (3500) WIFI: SYSTEM_EVENT_STA_GOT_IP
really connected
10 317 [IP-task] vDHCPProcess: offer ac141476ip
GAP procedure initiated: stop advertising.
246F2825D19C
thing_name:ESP_246F2825D19C
I (3520) gpio: GPIO[4]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3530) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3540) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3550) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3560) gpio: GPIO[12]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3570) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3580) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3590) gpio: GPIO[15]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
GAP procedure initiated: sto28vertising.
11 319 [iot_thread] [INFO ][DEMO][3190] Successfully initialized the demo. Network type for the demo: 1
12 319 [iot_thread] printing mac address:13 327 [iot_thread] [INFO ][MQTT][3270] MQTT library successfully initialized.
14 327 [iot_thread] [INFO ][Shadow][3270] Shadow library successfully initialized.
15 327 [iot_thread] [INFO ][DEMO][3270] Shadow Thing Name is ESP_246F2825D19C (length 16).
16 334 [iot_thread] DNS[0xBC58]: The answer to 'a1l1zbts62o6u8-ats.iot.eu-west-1.amazonaws.com' (34d40082ip) will be stored
I (3920) PKCS11: Initializing NVS partition: "storage"
17 374 [IP-task] Heap: current 102000 lowest 100460
18 399 [IP-task] Heap: current 98768 lowest 96540
19 476 [IP-task] Heap: current 85728 lowest 84828
20 491 [wifi] Heap: current 84892 lowest 84796
21 502 [wifi] Heap: current 85036 lowest 84460
22 502 [IP-task] Network buffers: 15 lowest 14
23 522 [wifi] Heap: current 84484 lowest 84028
24 523 [wifi] Heap: current 84244 lowest 83956
25 532 [wifi] Heap: current 83904 lowest 83808
26 532 [wifi] Heap: current 83468 lowest 83364
27 593 [wifi] Heap: current 79544 lowest 75364
28 689 [IP-task] Heap: current 81872 lowest 74064
29 798 [wifi] Heap: current 70200 lowest 70108
30 829 [wifi] Heap: current 69784 lowest 69692
31 860 [wifi] Heap: current 69784 lowest 69260
32 892 [iot_thread] [INFO ][MQTT][8920] Establishing new MQTT connection.
33 892 [iot_thread] [INFO ][MQTT][8920] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
34 892 [iot_thread] [INFO ][MQTT][8920] (MQTT connection 0x3ffb5f30, CONNECT operation 0x3ffb40ec) Waiting for operation completion.
35 923 [iot_thread] [INFO ][MQTT][9230] (MQTT connection 0x3ffb5f30, CONNECT operation 0x3ffb40ec) Wait complete with result SUCCESS.
36 923 [iot_thread] [INFO ][MQTT][9230] New MQTT connection 0x3ffb3e10 established.
37 923 [iot_thread] [INFO ][Shadow][9230] (ESP_246F2825D19C) Modifying Shadow DELTA callback.
38 923 [iot_thread] [INFO ][Shadow][9230] (ESP_246F2825D19C) Adding new DELTA callback.
39 923 [iot_thread] [INFO ][MQTT][9230] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
40 923 [iot_thread] [INFO ][MQTT][9230] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e6c) Waiting for operation completion.
41 943 [iot_thread] [INFO ][MQTT][9430] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e6c) Wait complete with result SUCCESS.
42 943 [iot_thread] [INFO ][Shadow][9430] (ESP_246F2825D19C) Shadow DELTA callback operation complete with result SUCCESS.
43 943 [iot_thread] [INFO ][Shadow][9430] (ESP_246F2825D19C) Modifying Shadow UPDATED callback.
44 943 [iot_thread] [INFO ][Shadow][9430] (ESP_246F2825D19C) Adding new UPDATED callback.
45 943 [iot_thread] [INFO ][MQTT][9430] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
46 943 [iot_thread] [INFO ][MQTT][9430] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb40ec) Waiting for operation completion.
47 973 [iot_thread] [INFO ][MQTT][9730] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb40ec) Wait complete with result SUCCESS.
48 973 [iot_thread] [INFO ][Shadow][9730] (ESP_246F2825D19C) Shadow UPDATED callback operation complete with result SUCCESS.
49 973 [iot_thread] [INFO ][MQTT][9730] MQTT library successfully initialized.
50 973 [iot_thread] [INFO ][Shadow][9730] Shadow library successfully initialized.
51 973 [iot_thread] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
52 977 [iot_thread] [OTA_AgentInit_internal] OTA Task is Ready.
53 977 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [Ready] Event [Start] New state [RequestingJob]
54 977 [OTA Agent Task] [INFO ][MQTT][9770] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
55 977 [OTA Agent Task] [INFO ][MQTT][9770] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Waiting for operation completion.
56 1004 [OTA Agent Task] [INFO ][MQTT][10030] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Wait complete with result SUCCESS.
57 1004 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/$next/get/accepted
58 1004 [OTA Agent Task] [INFO ][MQTT][10040] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
59 1004 [OTA Agent Task] [INFO ][MQTT][10040] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Waiting for operation completion.
60 1035 [OTA Agent Task] [INFO ][MQTT][10350] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Wait complete with result SUCCESS.
61 1035 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/notify-next
62 1035 [OTA Agent Task] [prvRequestJob_Mqtt] Request #0
63 1035 [OTA Agent Task] [INFO ][MQTT][10350] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
64 1036 [OTA Agent Task] [INFO ][MQTT][10350] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9d3c) Waiting for operation completion.
65 1065 [IP-task] Network buffers: 13 lowest 13
66 1065 [OTA Agent Task] [INFO ][MQTT][10650] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9d3c) Wait complete with result SUCCESS.
67 1065 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [RequestingJob] Event [RequestJobDocument] New state [WaitingForJob]
I (11000) ota_pal: prvPAL_SetPlatformImageState, 3
W (11000) ota_pal: Set image as invalid!
I (11010) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11010) esp_ota_ops: [1] aflags/seq:0x1/0x2, pflags/seq:0x2/0x1
I (11020) esp_ota_ops: aws_esp_ota_set_boot_flags: 3 1
I (11030) esp_ota_ops: [1] aflags/seq:0x1/0x2, pflags/seq:0x2/0x1
68 1067 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
69 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
70 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ jobId: AFR_OTA-final_test ]
71 1067 [OTA Agent Task] [prvParseJSONbyModel] Identified parameter [ self_test ]
72 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ updatedBy: 16777216 ]
73 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ protocols: ["MQTT"] ]
74 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ streamname: AFR_OTA-0e68aa19-5e9b-4d72-b15d-4a3857fd615b ]
75 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ filepath: /var ]
76 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ filesize: 994352 ]
77 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ fileid: 0 ]
78 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ certfile: arn:aws:acm:eu-west-1:956711000280:certificate/aff86477-6fbc-4ffd-9cc9-766c3b75c5a2 ]
79 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ sig-sha256-ecdsa: MEUCIQCgWfBXPXL0tGPP2lh2+aB6Cwzo... ]
80 1067 [OTA Agent Task] [prvParseJobDoc] In self test mode.
81 1067 [OTA Agent Task] [prvParseJobDoc] Failing job. We rebooted and the version is still the same.
82 1077 [iot_thread] State: Ready  Received: 1   Queued: 0   Processed: 0   Dropped: 0
83 1077 [iot_thread] [INFO ][MQTT][10770] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
84 1077 [iot_thread] [INFO ][MQTT][10770] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Waiting for operation completion.
I (11090) ota_pal: Disabling RTC hardware watchdog timer
I (11230) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11230) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0x3/0x0
85 1091 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] Msg: {"status":"FAILED","statusDetails":{"reason":"rejected: 0x23000000"}}
86 1091 [OTA Agent Task] [INFO ][MQTT][10910] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
87 1091 [OTA Agent Task] [INFO ][MQTT][10910] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9b9c) Waiting for operation completion.
88 1098 [iot_thread] [INFO ][MQTT][10970] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Wait complete with result SUCCESS.
89 1098 [iot_thread] [INFO ][MQTT][10980] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
90 1098 [iot_thread] [INFO ][MQTT][10980] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e74) Waiting for operation completion.
91 1116 [OTA Agent Task] [INFO ][MQTT][11160] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9b9c) Wait complete with result SUCCESS.
92 1116 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] 'FAILED' to $aws/things/ESP_246F2825D19C/jobs/AFR_OTA-final_test/update
93 1116 [OTA Agent Task] [prvResetDevice] Attempting forced reset of device...
94 1119 [iot_thread] [INFO ][MQTT][11190] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e74) Wait complete with result SUCCESS.
95 1119 [iot_thread] [INFO ][MQTT][11190] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
96 1147 [iot_thread] [INFO ][Shadow][11470] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
I (11990) wifi: state: run -> init (0)
I (11990) wifi: pm stop, total sleep time: 6359910 us / 9385944 us
I (11990) wifi: new:<7,0>, old:<7,1>, ap:<255,255>, sta:<7,1>, prof:1
I (11990) WIFI: SYSTEM_EVENT_STA_DISCONNECTED: 8
I (12000) BTDM_INIT: BT controller compile version [9891bc6]
I (12000) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (12270) wifi: flush txq
I (12270) wifi: stop sw txq
I (12270) wifi: lmac stop hw txq
I (13) boot: ESP-IDF  2nd stage bootloader
I (13) boot: compile time 20:46:52
I (13) boot: Enabling RNG early entropy source...
I (16) boot: SPI Speed      : 40MHz
I (20) boot: SPI Mode       : DIO
I (24) boot: SPI Flash Size : 4MB
I (28) boot: Partition Table:
I (32) boot: ## Label            Usage          Type ST Offset   Length
I (39) boot:  0 nvs              WiFi data        01 02 00010000 00006000
I (46) boot:  1 otadata          OTA data         01 00 00016000 00002000
I (54) boot:  2 phy_init         RF data          01 01 00018000 00001000
I (61) boot:  3 ota_0            OTA app          00 10 00020000 00177000
I (69) boot:  4 ota_1            OTA app          00 11 001a0000 00177000
I (76) boot:  5 storage          WiFi data        01 02 00317000 00010000
I (84) boot: End of partition table
W (88) boot: Deleting passive firmware @0x1a0000 len:0x177000
I (4147) boot: ota rollback check done
I (4147) boot_comm: chip revision: 1, min. application chip revision: 0
I (4147) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x2835c (164700) map
I (4214) esp_image: segment 1: paddr=0x00048384 vaddr=0x3ffbdb60 size=0x034e4 ( 13540) load
I (4220) esp_image: segment 2: paddr=0x0004b870 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at /home/firewires/Desktop/esp/starboard/amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1685
I (4222) esp_image: segment 3: paddr=0x0004bc78 vaddr=0x40080400 size=0x04398 ( 17304) load
I (4238) esp_image: segment 4: paddr=0x00050018 vaddr=0x400d0018 size=0xb0480 (722048) map
0x400d0018: _flash_cache_start at ??:?
I (4493) esp_image: segment 5: paddr=0x001004a0 vaddr=0x40084798 size=0x12758 ( 75608) load
0x40084798: set_chan_dig_gain at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_cal.c:2462 (discriminator 1)
I (4538) boot: Loaded app from partition at offset 0x20000
I (4538) boot: Disabling RNG early entropy source...
I (4539) cpu_start: Pro cpu up.
I (4542) cpu_start: Application information:
I (4547) cpu_start: Project name:     aws_demos
I (4552) cpu_start: App version:      cd6e4a6-dirty
I (4558) cpu_start: Compile time:     Feb 26 2020 00:01:13
I (4564) cpu_start: ELF file SHA256:  92ad132816aba035...
I (4570) cpu_start: ESP-IDF:
I (4574) cpu_start: Single core mode
I (4579) heap_init: Initializing. RAM available for dynamic allocation:
I (4586) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (4592) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (4598) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (4605) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (4611) heap_init: At 3FFCFCB8 len 00010348 (64 KiB): DRAM
I (4617) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (4623) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (4630) heap_init: At 40096EF0 len 00009110 (36 KiB): IRAM
I (4636) cpu_start: Pro cpu start user code
I (292) cpu_start: Starting scheduler on PRO CPU.
I (333) uart: queue free spaces: 10
0 2 [main] Initializing FreeRTOS TCP stack
printing current version 1.0.0
1 3 [iot_thread] [INFO ][DEMO][30] ---------STARTING DEMO---------
I (343) BTDM_INIT: BT controller compile version [9891bc6]
2 3 [iot_thread] [INFO ][INIT][30] SDK successfully initialized.
I (353) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (453) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
GAP procedure initiated: stop advertising.
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=187 adv_itvl_max=375
I (743) wifi: wifi driver task: 3ffba478, prio:23, stack:3584, core=0
I (743) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (743) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (763) wifi: wifi firmware version: c94f3e6
I (763) wifi: config NVS flash: enabled
I (763) wifi: config nano formating: disabled
I (763) wifi: Init dynamic tx buffer num: 32
I (773) wifi: Init data frame dynamic rx buffer num: 32
I (773) wifi: Init management frame dynamic rx buffer num: 32
I (783) wifi: Init management short buffer num: 32
I (783) wifi: Init static rx buffer size: 1600
I (793) wifi: Init static rx buffer num: 10
I (793) wifi: Init dynamic rx buffer num: 32
3 49 [iot_thread] [INFO ][DEMO][490] No networks connected for the demo. Waiting for a network connection.
I (813) wifi: mode : sta (24:6f:28:25:d1:9c)
I (813) WIFI: SYSTEM_EVENT_STA_START
I (1663) wifi: new:<7,1>, old:<1,0>, ap:<255,255>, sta:<7,1>, prof:1
I (2653) wifi: state: init -> auth (b0)
I (2663) wifi: state: auth -> assoc (0)
I (2673) wifi: state: assoc -> run (10)
I (2713) wifi: connected with FirewiresAct, channel 7, 40U, bssid = 98:da:c4:2a:44:1a
I (2713) wifi: pm start, type: 1
I (2713) WIFI: SYSTEM_EVENT_STA_CONNECTED
4 244 [wifi] Network buffers: 16 lowest 16
5 244 [wifi] Heap: current 119040 lowest 104268
6 244 [wifi] Network buffers: 15 lowest 15
246F2825D19C
thing_name:ESP_246F2825D19C
7 302 [IP-task] printing mac address:8 302 [IP-task] Network buffers: 15 lowest 14
246F2825D19C
thing_name:ESP_246F2825D19C
9 316 [IP-task] vDHCPProcess: offer ac141476ip
10 316 [IP-task] printing mac address:I (3543) event: sta ip: <IP_ADDRESS>, mask: <IP_ADDRESS>, gw: <IP_ADDRESS>
I (3543) WIFI: SYSTEM_EVENT_STA_GOT_IP
really connected
11 323 [IP-task] vDHCPProcess: offer ac141476ip
GAP procedure initiated: stop advertising.
12 324 [iot_thread] [INFO ][DEMO][3240] Successfully initialized the demo. Network type for the demo: 1
13 324 [iot_thread] printing mac address:GAP procedure initiated: stop advertising.
246F2825D19C
thing_name:ESP_246F2825D19C
I (3573) gpio: GPIO[4]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3583) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3593) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3603) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0
I (3613) gpio: GPIO[12]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3623) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3633) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
I (3643) gpio: GPIO[15]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3
14 334 [iot_thread] [INFO ][MQTT][3340] MQTT library successfully initialized.
15 334 [iot_thread] [INFO ][Shadow][3340] Shadow library successfully initialized.
16 335 [iot_thread] [INFO ][DEMO][3350] Shadow Thing Name is ESP_246F2825D19C (length 16).
17 342 [iot_thread] DNS[0x78FE]: The answer to 'a1l1zbts62o6u8-ats.iot.eu-west-1.amazonaws.com' (34d40082ip) will be stored
I (4003) PKCS11: Initializing NVS partition: "storage"
18 383 [IP-task] Heap: current 101992 lowest 101108
19 387 [wifi] Heap: current 101172 lowest 99412
20 409 [IP-task] Heap: current 98760 lowest 97960
21 412 [wifi] Heap: current 98024 lowest 96264
22 484 [IP-task] Heap: current 85720 lowest 84828
23 510 [wifi] Heap: current 84676 lowest 84468
24 510 [IP-task] Heap: current 84896 lowest 84304
25 531 [wifi] Heap: current 84244 lowest 84156
26 541 [wifi] Heap: current 83392 lowest 83312
27 551 [wifi] Heap: current 78516 lowest 78428
28 551 [wifi] Heap: current 78232 lowest 78144
29 612 [wifi] Heap: current 79540 lowest 75360
30 653 [wifi] Heap: current 74144 lowest 74072
31 664 [wifi] Heap: current 77208 lowest 73788
32 786 [wifi] Heap: current 70188 lowest 70148
33 848 [wifi] Heap: current 71140 lowest 69612
34 879 [wifi] Heap: current 72440 lowest 69484
35 911 [iot_thread] [INFO ][MQTT][9110] Establishing new MQTT connection.
36 912 [iot_thread] [INFO ][MQTT][9120] Anonymous metrics (SDK language, SDK version) will be provided to AWS IoT. Recompile with AWS_IOT_MQTT_ENABLE_METRICS set to 0 to disable.
37 912 [iot_thread] [INFO ][MQTT][9120] (MQTT connection 0x3ffb5f30, CONNECT operation 0x3ffb4154) Waiting for operation completion.
38 941 [iot_thread] [INFO ][MQTT][9410] (MQTT connection 0x3ffb5f30, CONNECT operation 0x3ffb4154) Wait complete with result SUCCESS.
39 941 [iot_thread] [INFO ][MQTT][9410] New MQTT connection 0x3ffb3e10 established.
40 941 [iot_thread] [INFO ][Shadow][9410] (ESP_246F2825D19C) Modifying Shadow DELTA callback.
41 941 [iot_thread] [INFO ][Shadow][9410] (ESP_246F2825D19C) Adding new DELTA callback.
42 942 [iot_thread] [INFO ][MQTT][9420] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
43 942 [iot_thread] [INFO ][MQTT][9420] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffd6b7c) Waiting for operation completion.
44 962 [iot_thread] [INFO ][MQTT][9620] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffd6b7c) Wait complete with result SUCCESS.
45 962 [iot_thread] [INFO ][Shadow][9620] (ESP_246F2825D19C) Shadow DELTA callback operation complete with result SUCCESS.
46 962 [iot_thread] [INFO ][Shadow][9620] (ESP_246F2825D19C) Modifying Shadow UPDATED callback.
47 962 [iot_thread] [INFO ][Shadow][9620] (ESP_246F2825D19C) Adding new UPDATED callback.
48 963 [iot_thread] [INFO ][MQTT][9630] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
49 963 [iot_thread] [INFO ][MQTT][9630] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffbda34) Waiting for operation completion.
50 992 [iot_thread] [INFO ][MQTT][9920] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffbda34) Wait complete with result SUCCESS.
51 992 [iot_thread] [INFO ][Shadow][9920] (ESP_246F2825D19C) Shadow UPDATED callback operation complete with result SUCCESS.
52 992 [iot_thread] [INFO ][MQTT][9920] MQTT library successfully initialized.
53 992 [iot_thread] [INFO ][Shadow][9920] Shadow library successfully initialized.
54 992 [iot_thread] printing mac address:246F2825D19C
thing_name:ESP_246F2825D19C
55 996 [iot_thread] [OTA_AgentInit_internal] OTA Task is Ready.
56 996 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [Ready] Event [Start] New state [RequestingJob]
57 996 [OTA Agent Task] [INFO ][MQTT][9960] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
58 996 [OTA Agent Task] [INFO ][MQTT][9960] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9f84) Waiting for operation completion.
59 1024 [OTA Agent Task] [INFO ][MQTT][10240] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9f84) Wait complete with result SUCCESS.
60 1024 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/$next/get/accepted
61 1024 [OTA Agent Task] [INFO ][MQTT][10240] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
62 1024 [OTA Agent Task] [INFO ][MQTT][10240] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9f84) Waiting for operation completion.
63 1054 [OTA Agent Task] [INFO ][MQTT][10540] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9f84) Wait complete with result SUCCESS.
64 1054 [OTA Agent Task] [prvSubscribeToJobNotificationTopics] OK: $aws/things/ESP_246F2825D19C/jobs/notify-next
65 1054 [OTA Agent Task] [prvRequestJob_Mqtt] Request #0
66 1054 [OTA Agent Task] [INFO ][MQTT][10540] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
67 1054 [OTA Agent Task] [INFO ][MQTT][10540] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9f84) Waiting for operation completion.
68 1084 [OTA Agent Task] [INFO ][MQTT][10840] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9f84) Wait complete with result SUCCESS.
69 1084 [OTA Agent Task] [prvOTAAgentTask] Called handler. Current State [RequestingJob] Event [RequestJobDocument] New state [WaitingForJob]
I (11173) ota_pal: prvPAL_SetPlatformImageState, 4
W (11173) ota_pal: Set image as aborted!
I (11183) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11183) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
W (11193) ota_pal: Image not in self test mode 2
I (11203) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11203) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0xffffffff/0x0
70 1086 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
71 1086 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
72 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: execution
73 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobId
74 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: jobDocument
75 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: afr_ota
76 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: protocols
77 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: files
78 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filepath
79 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: filesize
80 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: fileid
81 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: certfile
82 1086 [OTA Agent Task] [prvParseJSONbyModel] parameter not present: sig-sha256-ecdsa
83 1086 [OTA Agent Task] [prvDefaultCustomJobCallback] Received Custom Job inside OTA Agent which is not supported.
84 1086 [OTA Agent Task] [prvParseJobDoc] Ignoring job without ID.
85 1086 [OTA Agent Task] [prvOTA_Close] Context->0x0x3fff0c30
86 1090 [OTA Agent Task] [prvOTAAgentTask] Handler failed. Current State [WaitingForJob] Event  [ReceivedJobDocument] Error Code [603979776]
87 1096 [iot_thread] State: Ready  Received: 1   Queued: 0   Processed: 0   Dropped: 0
88 1096 [iot_thread] [INFO ][MQTT][10960] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
89 1096 [iot_thread] [INFO ][MQTT][10960] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffd6b7c) Waiting for operation completion.
90 1125 [iot_thread] [INFO ][MQTT][11250] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffd6b7c) Wait complete with result SUCCESS.
91 1125 [iot_thread] [INFO ][MQTT][11250] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
92 1125 [iot_thread] [INFO ][MQTT][11250] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffbda34) Waiting for operation completion.
93 1156 [iot_thread] [INFO ][MQTT][11560] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffbda34) Wait complete with result SUCCESS.
94 1156 [iot_thread] [INFO ][MQTT][11560] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
95 1186 [IP-task] Network buffers: 14 lowest 13
96 1208 [iot_thread] [INFO ][DEMO][12080] Shadow was updated!
Previous: {"state":{"desired":{"switch_1":0,"switch_2":0,"switch_3":0,"switch_4":0,"otajobflag":0},"reported":{"appVersion":"1.097 1209 [iot_thread] [INFO ][Shadow][12090] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
98 1320 [iot_thread] State: WaitingForJob  Received: 1   Queued: 0   Processed: 0   Dropped: 0
`

i think below logs are saying something.. :/
I (11000) ota_pal: prvPAL_SetPlatformImageState, 3
W (11000) ota_pal: Set image as invalid!
I (11010) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11010) esp_ota_ops: [1] aflags/seq:0x1/0x2, pflags/seq:0x2/0x1
I (11020) esp_ota_ops: aws_esp_ota_set_boot_flags: 3 1
I (11030) esp_ota_ops: [1] aflags/seq:0x1/0x2, pflags/seq:0x2/0x1
68 1067 [OTA Agent Task] [prvParseJobDoc] Size of OTA_FileContext_t [64]
69 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ clientToken: 0:ESP_246F2825D19C ]
70 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ jobId: AFR_OTA-final_test ]
71 1067 [OTA Agent Task] [prvParseJSONbyModel] Identified parameter [ self_test ]
72 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ updatedBy: 16777216 ]
73 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ protocols: ["MQTT"] ]
74 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ streamname: AFR_OTA-0e68aa19-5e9b-4d72-b15d-4a3857fd615b ]
75 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ filepath: /var ]
76 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ filesize: 994352 ]
77 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ fileid: 0 ]
78 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ certfile: arn:aws:acm:eu-west-1:956711000280:certificate/aff86477-6fbc-4ffd-9cc9-766c3b75c5a2 ]
79 1067 [OTA Agent Task] [prvParseJSONbyModel] Extracted parameter [ sig-sha256-ecdsa: MEUCIQCgWfBXPXL0tGPP2lh2+aB6Cwzo... ]
80 1067 [OTA Agent Task] [prvParseJobDoc] In self test mode.
81 1067 [OTA Agent Task] [prvParseJobDoc] Failing job. We rebooted and the version is still the same.
82 1077 [iot_thread] State: Ready  Received: 1   Queued: 0   Processed: 0   Dropped: 0
83 1077 [iot_thread] [INFO ][MQTT][10770] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
84 1077 [iot_thread] [INFO ][MQTT][10770] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation

0x3ffb9d3c) Waiting for operation completion.
I (11090) ota_pal: Disabling RTC hardware watchdog timer
I (11230) esp_ota_ops: aws_esp_ota_get_boot_flags: 1
I (11230) esp_ota_ops: [0] aflags/seq:0x2/0x1, pflags/seq:0x3/0x0
85 1091 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] Msg: {"status":"FAILED","statusDetails":{"reason":"rejected: 0x23000000"}}
86 1091 [OTA Agent Task] [INFO ][MQTT][10910] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.

87 1091 [OTA Agent Task] [INFO ][MQTT][10910] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9b9c) Waiting for operation completion.
88 1098 [iot_thread] [INFO ][MQTT][10970] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb9d3c) Wait complete with result SUCCESS.
89 1098 [iot_thread] [INFO ][MQTT][10980] (MQTT connection 0x3ffb5f30) SUBSCRIBE operation scheduled.
90 1098 [iot_thread] [INFO ][MQTT][10980] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e74) Waiting for operation completion.
91 1116 [OTA Agent Task] [INFO ][MQTT][11160] (MQTT connection 0x3ffb5f30, PUBLISH operation 0x3ffb9b9c) Wait complete with result SUCCESS.
92 1116 [OTA Agent Task] [prvUpdateJobStatus_Mqtt] 'FAILED' to $aws/things/ESP_246F2825D19C/jobs/AFR_OTA-final_test/update
93 1116 [OTA Agent Task] [prvResetDevice] Attempting forced reset of device...
94 1119 [iot_thread] [INFO ][MQTT][11190] (MQTT connection 0x3ffb5f30, SUBSCRIBE operation 0x3ffb5e74) Wait complete with result SUCCESS.
95 1119 [iot_thread] [INFO ][MQTT][11190] (MQTT connection 0x3ffb5f30) MQTT PUBLISH operation queued.
96 1147 [iot_thread] [INFO ][Shadow][11470] Shadow UPDATE of ESP_246F2825D19C was ACCEPTED.
I (11990) wifi: state: run -> init (0)
I (11990) wifi: pm stop, total sleep time: 6359910 us / 9385944 us
``

@abhidixi11 thanks it works fine it was little mistake that ota job failed
 1067 [OTA Agent Task] [prvParseJobDoc] Failing job. We rebooted and the version is still the same.
above line was hint and now ota and shadow demo both works fine with extra remaining :))
really appreciated all help
@yanjos-dev @htibosch @shubhamkulkarni97 @abhidixi11  thank you all of you