UPD Send frames Crash

tezaman
Posts: 7
Joined: Fri May 06, 2022 9:18 am

UPD Send frames Crash

Postby tezaman » Thu Nov 23, 2023 3:37 pm

Hi hello there

Scenario

STM8266
FREE RTOS SDK
>>>>>Connecting to Mobile phone Wifi HotSpot


I am sending UDP Messages to a mobile app around 90 per second, inside a task , with a while(1)
the problem is that the code crash on me randomly , the less vTaskdelay i use the more is crashing.
The connection between ESP and phone is Solid and very close together


ERROR

Code: Select all

91 Per Second 
91 Per Second 
91 Per Second 
91 Per Second 
91 Per Second 
83 Per Second 
24 Per Second 
[0;31mE (454685) wifi: no buf for probe, ie len 0[0m
4 Per Second 
5 Per Second 
5 Per Second 
4 Per Second 
5 Per Second 
pm 1253

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
abort() was called at PC 0x402518cb on core 0

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.

Core 0 register dump:
PC      : 0x402151b2  PS      : 0x00000033  A0      : 0x402151b0  A1      : 0x3fff9e20  

A2      : 0x00000000  A3      : 0x00000001  A4      : 0xffffffdb  A5      : 0x00000001  

A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0xffffffe3  

A10     : 0x00000010  A11     : 0xfffffffc  A12     : 0x401074b0  A13     : 0x00000004  

A14     : 0x40106f60  A15     : 0x40107314  SAR     : 0x0000001e  EXCCAUSE: 0x0000001d  


Backtrace: 0x402151b2:0x3fff9e20 0x402518ce:0x3fff9e30 0x40251a41:0x3fff9e40 0x4027d1f3:0x3fff9e50 0x4027d254:0x3fff9e70 0x4027d2fe:0x3fff9ea0 0x40219792:0x3fff9eb0 0x40219fa5:0x3fff9f40 0x4021a102:0x3fff9f50 0x4021a5d5:0x3fff9f60 0x4021a90a:0x3fff9f70 


 ets Jan  8 2013,rst cause:4, boot mode:(3,7)
CODE

Code: Select all

inside TASK 
			
			int sock = socket(addr_family, SOCK_DGRAM, ip_protocol);
            if (sock < 0)
            {
                printf("Unable to create socket: errno %d", errno);
                printf("Failed to create socket/n");
                break;
            }

            // Set timeout
            struct timeval timeout;
            timeout.tv_sec = 0;
            timeout.tv_usec = 0;
            setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);

            printf("Socket created, sending to %s:%d", SERVER_IP, SERVER_PORT);
             while (1)
            {

                const uint32_t cur_time = MY_MILLIS();


                    makedata();
 
                    if (elapsed_time(cur_time, send_time2) >= 1000)
                    {
                        send_time2 = cur_time;
                        printf("%d Per Second \n", countUDP);
                        countUDP = 0;
                    }

  
                    clientAddress.sin_family = AF_INET;
                    clientAddress.sin_port = htons(11000);

                    int sent3 = sendto(sock, (uint8_t *)data, sizeof(data), 0, (struct sockaddr *)&data, sizeof(clientAddress));

                    countUDP = countUDP + 1;
                    if (sent3 < 0)
                    {
                        printf(" send error number %d  from  Port %d %s \n", sent3, ntohs(clientAddress.sin_port), inet_ntoa(clientAddress.sin_addr));
                    }

                    if (elapsed_time(cur_time, send_time3) >= 20000)
                    {
                        send_time3 = cur_time;
                        sta_ip = wifi_got_ip();
                        ap_sta = wifi_ap_has_client();
                        connected = sta_ip || ap_sta;
                        printf("Check if is connected \n");
                    }
                }
                vTaskDelay(10);   //the more the better but costs me frames....
            }

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: UPD Send frames Crash

Postby MicroController » Thu Nov 23, 2023 9:41 pm


tezaman
Posts: 7
Joined: Fri May 06, 2022 9:18 am

Re: UPD Send frames Crash

Postby tezaman » Fri Nov 24, 2023 7:10 am

thanks

Interesting , i dont have this file xtensa-esp32-elf-addr2line.exe
i am using this version of xtensa https://dl.espressif.com/dl/xtensa-lx10 ... 2.0.tar.gz

tezaman
Posts: 7
Joined: Fri May 06, 2022 9:18 am

Re: UPD Send frames Crash

Postby tezaman » Fri Nov 24, 2023 8:56 am

***ERROR*** A stack overflow in task resource_ctrl has been detected.

abort() was called at PC 0x40214f73 on core 0

Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x402151c6 PS : 0x00000033 A0 : 0x402151c4 A1 : 0x3ffe81d0

A2 : 0x00000000 A3 : 0x00000001 A4 : 0xffffffdb A5 : 0x00000001

A6 : 0x00000000 A7 : 0x000400e6 A8 : 0x0fa0b86b A9 : 0x00000090

A10 : 0x3ffef803 A11 : 0x00000030 A12 : 0x00000080 A13 : 0x00000007

A14 : 0x00000080 A15 : 0x3ffe9450 SAR : 0x0000001e EXCCAUSE: 0x0000001d



Backtrace: 0x402151c6:0x3ffe81d0 0x40214f76:0x3ffe81e0 0x401011cc:0x3ffe81f0 0x40101253:0x3ffe8200 0x401014a6:0x3ffe8210 0x401003c8:0x3ffe8230

tezaman
Posts: 7
Joined: Fri May 06, 2022 9:18 am

Re: UPD Send frames Crash

Postby tezaman » Fri Nov 24, 2023 11:13 am

i found that theres a memory leak , the heap is getting lower and lower at some point and crash ,
i have to check where this is happening

Who is online

Users browsing this forum: Google [Bot], Teh2024 and 98 guests