Mark, I'm looking for the memory allocated to nonexistant tasks. In my code I added a call to AddTaskToMap() after the creation of the NetManTask. Now I see that the nonexistant task holding 264 bytes was an earlier instance of NetManTask. Do you expect it to be created, killed, and created again? I'm considering making a public function that will query the task list to populate the TaskMap, same as what is done now when the module memory or module tasks command is invoked. Then I would add some calls to that function at one or more places in system startup to try to capture the other unnamed task while it exists. Any suggestions for where to make such a call? The output below is with the aforementioned AddTaskToMap() call added plus some changes in ovms_module to list the tasks in module memory in task number order so the order is consistent from one run to the next and with the nonexistent ones first and marked with asterisk. I can commit these changes if that is OK at this point. -- Steve Free 8-bit 31760/283148, 32-bit 27588/55864, SPIRAM 0/0 --Task-- Total DRAM D/IRAM IRAM SPIRAM +/- DRAM D/IRAM IRAM SPIRAM no task * 5276 0 0 0 +5276 +0 +0 +0 main * 40076 0 0 0 +40076 +0 +0 +0 3FFE5CDC * 0 1396 0 0 +0 +1396 +0 +0 NetManTask * 0 264 0 0 +0 +264 +0 +0 esp_timer 55112 0 644 0 +55112 +0 +644 +0 eventTask 0 7620 0 0 +0 +7620 +0 +0 ipc0 10848 0 0 0 +10848 +0 +0 +0 ipc1 12 0 0 0 +12 +0 +0 +0 Tmr Svc 0 27808 0 0 +0 +27808 +0 +0 Housekeeping 17488 50384 0 0 +17488 +50384 +0 +0 tiT 128 1640 0 0 +128 +1640 +0 +0 AsyncConsole 0 20 27488 0 +0 +20 +27488 +0 mdns 0 112 0 0 +0 +112 +0 +0 wifi 0 1612 0 0 +0 +1612 +0 +0 NetManTask 4 2200 0 0 +4 +2200 +0 +0
The NetManTask is actually mongoose (or the task that runs the mongoose event loop from within netmanager). There should only be one running at any one time. But it can be started/stopped many times. That task delivers mongoose events to users, so the memory allocations could also be in response to those events. Note that there was a logic problem with this, that was definitely causing issues. I fixed that this morning. Is it repeatable still for you? Happy if you want to add the AddTaskToMap to ovms_netmanager, or tell me how it should go in and I’ll do it. With current code, you can stop NetManTask by stopping ALL network interfaces (modem, wifi ap and client). You can start NetManTask by creating one or more network interfaces (start a modem or wifi ap or client). Regards, Mark.
On 20 Mar 2018, at 2:34 PM, Stephen Casner <casner@acm.org> wrote:
Mark,
I'm looking for the memory allocated to nonexistant tasks. In my code I added a call to AddTaskToMap() after the creation of the NetManTask. Now I see that the nonexistant task holding 264 bytes was an earlier instance of NetManTask. Do you expect it to be created, killed, and created again?
I'm considering making a public function that will query the task list to populate the TaskMap, same as what is done now when the module memory or module tasks command is invoked. Then I would add some calls to that function at one or more places in system startup to try to capture the other unnamed task while it exists. Any suggestions for where to make such a call?
The output below is with the aforementioned AddTaskToMap() call added plus some changes in ovms_module to list the tasks in module memory in task number order so the order is consistent from one run to the next and with the nonexistent ones first and marked with asterisk. I can commit these changes if that is OK at this point.
-- Steve
Free 8-bit 31760/283148, 32-bit 27588/55864, SPIRAM 0/0 --Task-- Total DRAM D/IRAM IRAM SPIRAM +/- DRAM D/IRAM IRAM SPIRAM no task * 5276 0 0 0 +5276 +0 +0 +0 main * 40076 0 0 0 +40076 +0 +0 +0 3FFE5CDC * 0 1396 0 0 +0 +1396 +0 +0 NetManTask * 0 264 0 0 +0 +264 +0 +0 esp_timer 55112 0 644 0 +55112 +0 +644 +0 eventTask 0 7620 0 0 +0 +7620 +0 +0 ipc0 10848 0 0 0 +10848 +0 +0 +0 ipc1 12 0 0 0 +12 +0 +0 +0 Tmr Svc 0 27808 0 0 +0 +27808 +0 +0 Housekeeping 17488 50384 0 0 +17488 +50384 +0 +0 tiT 128 1640 0 0 +128 +1640 +0 +0 AsyncConsole 0 20 27488 0 +0 +20 +27488 +0 mdns 0 112 0 0 +0 +112 +0 +0 wifi 0 1612 0 0 +0 +1612 +0 +0 NetManTask 4 2200 0 0 +4 +2200 +0 +0 _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
The example I showed is with all your committed changes included. I expected only one NetManTask at a time, but I did not realize it would be stopped and restarted. It would be nice to know what memory is allocated but not freed. It may not be leaked if it is for resources that are used by other tasks, but still it would be nice to have all the memory properly accounted for. Below is my startup sequence. This may be AP auto-starting and then stopping, followed by client mode starting from my script. Without the modem running, there might be no interfaces up between those two operations. -- Steve Welcome to the Open Vehicle Monitoring System (OVMS) - Async Console I (1982) ovms-mdns: Starting MDNS I (1982) ssh: Launching SSH Server I (2012) version: Set version I (2012) script: Running script /store/events/system.start/startmeup I (2012) wifi: flush txq I (2012) wifi: stop sw txq I (2012) wifi: lmac stop hw txq I (2022) wifi: Deinit lldesc rx mblock:4 I (2022) wifi: wifi firmware version: ebd3e5d I (2022) wifi: config NVS flash: enabled I (2022) wifi: config nano formating: disabled I (2022) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (2022) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (2032) wifi: Init dynamic tx buffer num: 16 I (2032) wifi: Init data frame dynamic rx buffer num: 16 I (2032) wifi: Init management frame dynamic rx buffer num: 16 I (2032) wifi: wifi driver task: 3ffe5ea0, prio:23, stack:4096 I (2032) wifi: Init static rx buffer num: 4 I (2032) wifi: Init dynamic rx buffer num: 16 I (2032) wifi: wifi power manager task: 0x3ffe7e14 prio: 21 stack: 2560 I (2042) wifi: mode : sta (30:ae:a4:37:1b:84) I (2042) netmanager: WIFI access point is down I (2052) esp32wifi: AP stopped Starting WIFI as a client to Revelstoke... I (2072) simcom: State: Enter CheckPowerOff state I (2242) webserver: Stopping Web Server I (2242) telnet: Stopping Telnet Server I (2242) ssh: Stopping SSH Server I (4462) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1 I (5112) wifi: state: init -> auth (b0) I (5122) wifi: state: auth -> assoc (0) I (5132) wifi: state: assoc -> run (10) I (5172) wifi: connected with Revelstoke, channel 1 I (6692) event: sta ip: 192.168.1.84, mask: 255.255.255.0, gw: 192.168.1.254 I (6702) netmanager: Interface priority is st2 (192.168.1.84/255.255.255.0 gateway 192.168.1.254) I (6702) netmanager: WIFI client up (with MODEM down): starting network with WIFI client I (6702) time: Starting SNTP client I (6712) esp32wifi: WiFi UP with SSID: Revelstoke, MAC: 30:ae:a4:37:1b:84, IP: 192.168.1.84, mask: 255.255.255.0, gw: 192.168.1.254 I (6712) webserver: Launching Web Server I (6732) telnet: Launching Telnet Server I (6742) ssh: Launching SSH Server I (8132) wifi: pm start, type:0 I (12062) housekeeping: System considered stable (free: 31760 bytes) I (16002) simcom: State timeout, transition to 13 I (16002) simcom: State: Enter PoweredOff state I (16002) gsm-mux: Stop MUX
I need to check if everything gets cleaned up in the webserver on "network.mgr.stop". I currently rely on mongoose sending all connections an MG_EV_CLOSE on shutdown, and I haven't checked if that is that guaranteed to happen. But that could only lead to a memory leak if the netman instance would be shut down while serving a file (ROM/SD) or command result. Regards, Michael Am 20.03.2018 um 07:53 schrieb Stephen Casner:
The example I showed is with all your committed changes included.
I expected only one NetManTask at a time, but I did not realize it would be stopped and restarted. It would be nice to know what memory is allocated but not freed. It may not be leaked if it is for resources that are used by other tasks, but still it would be nice to have all the memory properly accounted for.
Below is my startup sequence. This may be AP auto-starting and then stopping, followed by client mode starting from my script. Without the modem running, there might be no interfaces up between those two operations.
-- Steve
Welcome to the Open Vehicle Monitoring System (OVMS) - Async Console I (1982) ovms-mdns: Starting MDNS I (1982) ssh: Launching SSH Server I (2012) version: Set version I (2012) script: Running script /store/events/system.start/startmeup I (2012) wifi: flush txq I (2012) wifi: stop sw txq I (2012) wifi: lmac stop hw txq I (2022) wifi: Deinit lldesc rx mblock:4 I (2022) wifi: wifi firmware version: ebd3e5d I (2022) wifi: config NVS flash: enabled I (2022) wifi: config nano formating: disabled I (2022) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (2022) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE I (2032) wifi: Init dynamic tx buffer num: 16 I (2032) wifi: Init data frame dynamic rx buffer num: 16 I (2032) wifi: Init management frame dynamic rx buffer num: 16 I (2032) wifi: wifi driver task: 3ffe5ea0, prio:23, stack:4096 I (2032) wifi: Init static rx buffer num: 4 I (2032) wifi: Init dynamic rx buffer num: 16 I (2032) wifi: wifi power manager task: 0x3ffe7e14 prio: 21 stack: 2560 I (2042) wifi: mode : sta (30:ae:a4:37:1b:84) I (2042) netmanager: WIFI access point is down I (2052) esp32wifi: AP stopped Starting WIFI as a client to Revelstoke... I (2072) simcom: State: Enter CheckPowerOff state I (2242) webserver: Stopping Web Server I (2242) telnet: Stopping Telnet Server I (2242) ssh: Stopping SSH Server I (4462) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1 I (5112) wifi: state: init -> auth (b0) I (5122) wifi: state: auth -> assoc (0) I (5132) wifi: state: assoc -> run (10) I (5172) wifi: connected with Revelstoke, channel 1 I (6692) event: sta ip: 192.168.1.84, mask: 255.255.255.0, gw: 192.168.1.254 I (6702) netmanager: Interface priority is st2 (192.168.1.84/255.255.255.0 gateway 192.168.1.254) I (6702) netmanager: WIFI client up (with MODEM down): starting network with WIFI client I (6702) time: Starting SNTP client I (6712) esp32wifi: WiFi UP with SSID: Revelstoke, MAC: 30:ae:a4:37:1b:84, IP: 192.168.1.84, mask: 255.255.255.0, gw: 192.168.1.254 I (6712) webserver: Launching Web Server I (6732) telnet: Launching Telnet Server I (6742) ssh: Launching SSH Server I (8132) wifi: pm start, type:0 I (12062) housekeeping: System considered stable (free: 31760 bytes) I (16002) simcom: State timeout, transition to 13 I (16002) simcom: State: Enter PoweredOff state I (16002) gsm-mux: Stop MUX _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
-- Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
participants (3)
-
Mark Webb-Johnson -
Michael Balzer -
Stephen Casner