{"action":"created","issue":{"url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/71","labels_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/71/comments","events_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/71/events","html_url":"https://github.com/SuperHouse/esp-open-rtos/issues/71","id":118727213,"number":71,"title":"Fatal exception in netconn","user":{"login":"recursify","id":403253,"avatar_url":"https://avatars.githubusercontent.com/u/403253?v=3","gravatar_id":"","url":"https://api.github.com/users/recursify","html_url":"https://github.com/recursify","followers_url":"https://api.github.com/users/recursify/followers","following_url":"https://api.github.com/users/recursify/following{/other_user}","gists_url":"https://api.github.com/users/recursify/gists{/gist_id}","starred_url":"https://api.github.com/users/recursify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recursify/subscriptions","organizations_url":"https://api.github.com/users/recursify/orgs","repos_url":"https://api.github.com/users/recursify/repos","events_url":"https://api.github.com/users/recursify/events{/privacy}","received_events_url":"https://api.github.com/users/recursify/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-24T23:38:26Z","updated_at":"2015-11-24T23:41:32Z","closed_at":null,"body":"After connecting to wifi, I'm running the following code in a loop with a small delay:\r\n\r\n```\r\nvoid run(void) {\r\n    struct netconn * conn;\r\n    struct netbuf * buffer;\r\n    struct ip_addr remote_ip;\r\n    uint16_t len;\r\n    void * indata;\r\n    printf(\"About to create new buffer\\n\");\r\n\r\n    buffer = netbuf_new();\r\n    if(buffer == NULL) {\r\n        printf(\"buffer create failed!\\n\");\r\n        return;\r\n    }\r\n    printf(\"About to alloc buffer \\n\");\r\n    indata = netbuf_alloc(buffer, 256);\r\n    if(indata == NULL) {\r\n        printf(\"buffer alloc failed!\\n\");\r\n        return;\r\n    }\r\n\r\n    printf(\"About to do DNS \\n\");\r\n    netconn_gethostbyname(\"kenshi2.internal\", &remote_ip);\r\n\r\n    printf(\"About to create new tcp conn \\n\");\r\n    conn = netconn_new(NETCONN_TCP);\r\n    if(conn == NULL) {\r\n        printf(\"conn new failed!\\n\");\r\n        return;\r\n    }\r\n\r\n    printf(\"connecting..\\n\");\r\n    netconn_connect(conn, &remote_ip, 5555);\r\n    netconn_set_recvtimeout(conn, 20);\r\n    printf(\"writing..\\n\");\r\n    netconn_write(conn, (void *)data, 12, NETCONN_NOCOPY);\r\n    printf(\"receiving..\\n\");\r\n    netconn_recv(conn, &buffer);\r\n\r\n    printf(\"Closing connection\\n\");\r\n    netconn_close(conn);\r\n    printf(\"delete netconn\\n\");\r\n    netconn_delete(conn);\r\n    printf(\"delete buffer\\n\");\r\n    netbuf_delete(buffer);\r\n\r\n}\r\n\r\nvoid main_loop(void *pvParameters) {\r\n    //... setup\r\n    while(1) {\r\n        run();\r\n        vTaskDelay(100 / portTICK_RATE_MS);\r\n    }\r\n}\r\n```\r\n\r\nWhich will run several dozen times before: \r\n\r\n```\r\nAbout to create new buffer\r\nAbout to alloc buffer\r\nAbout to do DNS\r\nAbout to create new tcp conn\r\nconnecting..\r\nFatal exception (3):\r\nepc1=0x40225aff\r\nepc2=0x00000000\r\nepc3=0x40222379\r\nexcvaddr=0x400003e8\r\ndepc=0x00000000\r\nexcsave1=0x3fff3870\r\n```\r\n\r\nAnd here is the result of addrsource:\r\n\r\n```\r\n./utils/addrsource  0x40225aff examples/open-rtos-app/build/app.out\r\n0x40225aff is in tcp_output (/home/vagrant/espressif/esp-open-rtos/lwip/lwip/src/core/tcp_out.c:994).\r\n989\t      TCPH_SET_FLAG(seg->tcphdr, TCP_ACK);\r\n990\t      pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);\r\n991\t    }\r\n992\r\n993\t    tcp_output_segment(seg, pcb);\r\n994\t    snd_nxt = ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg);\r\n995\t    if (TCP_SEQ_LT(pcb->snd_nxt, snd_nxt)) {\r\n996\t      pcb->snd_nxt = snd_nxt;\r\n997\t    }\r\n998\t    /* put segment on unacknowledged list if length > 0 */\r\nLine 994 of \"/home/vagrant/espressif/esp-open-rtos/lwip/lwip/src/core/tcp_out.c\" starts at address 0x40225aed <tcp_output+665> and ends at 0x40225b3a <tcp_output+742>.\r\n```"},"comment":{"url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/comments/159440517","html_url":"https://github.com/SuperHouse/esp-open-rtos/issues/71#issuecomment-159440517","issue_url":"https://api.github.com/repos/SuperHouse/esp-open-rtos/issues/71","id":159440517,"user":{"login":"recursify","id":403253,"avatar_url":"https://avatars.githubusercontent.com/u/403253?v=3","gravatar_id":"","url":"https://api.github.com/users/recursify","html_url":"https://github.com/recursify","followers_url":"https://api.github.com/users/recursify/followers","following_url":"https://api.github.com/users/recursify/following{/other_user}","gists_url":"https://api.github.com/users/recursify/gists{/gist_id}","starred_url":"https://api.github.com/users/recursify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recursify/subscriptions","organizations_url":"https://api.github.com/users/recursify/orgs","repos_url":"https://api.github.com/users/recursify/repos","events_url":"https://api.github.com/users/recursify/events{/privacy}","received_events_url":"https://api.github.com/users/recursify/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T23:41:32Z","updated_at":"2015-11-24T23:41:32Z","body":"I suspect this is an issue with lwip, but let me know if you need more info."}}