Hot!PIC32 Webserver connection getting lost

Author
SARATHZARATH
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2019/01/29 04:44:03
  • Location: 0
  • Status: offline
2019/03/17 22:05:55 (permalink)
0

PIC32 Webserver connection getting lost

Hi, 

We are using pic32mz2048efh064 for one of our IP based appliance project. We could successfully develop a web server by taking the web_server_nvm_mpfs sample project as reference. 

Currently we are facing a web hanging issue. When our controller is accessed in local ip address, there is no issue. But when we provide a public ip and port forward to the local ip of the controller, this happens quite a few times(A total of 5 times in two weeks).But when the web is not responding, we are able to ping to the local ip of the controller from inside our network. Please help to sort out this issue. 

If we restart our controller everything seems to be working perfectly fine but after few days same issue happens again.
 
 
I am attaching system_config.h for reference.
Harmony version used  v2_04
MPLAB X IDE v4.10
XC32 v1.42
post edited by SARATHZARATH - 2019/03/18 22:17:28
#1

7 Replies Related Threads

    jg_ee
    Super Member
    • Total Posts : 142
    • Reward points : 0
    • Joined: 2015/04/30 10:54:52
    • Location: Colorado
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/20 11:39:48 (permalink)
    5 (1)
    Going to be something with your router most likely, doesn't sound related to the PIC32 web server.
    #2
    Jim Nickerson
    User 452
    • Total Posts : 5842
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: online
    Re: PIC32 Webserver connection getting lost 2019/03/20 12:12:55 (permalink)
    0
    The router is "too" smart, maybe it is shutting down the pic due to some "problem" it percieves.
    I foresee many hours of Wireshark logs.
    #3
    SARATHZARATH
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2019/01/29 04:44:03
    • Location: 0
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/20 20:44:07 (permalink)
    0
    Thanks JG and Jim for your suggestions.
     
    But I would like to include that this scenario is occurring not only in my network setup. IF I connect the controller to a different location with a public IP, the same is the situation.
     
     
    #4
    rainad
    Super Member
    • Total Posts : 1118
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/21 08:08:34 (permalink)
    0
    I suggest you get a wireshark log of the http connection on the network link between the PIC32 and your router. Maybe we can learn something from it.
    Some commands from the console that could be tried when this happens: "macinfo", "heapinfo", and "tcpinfo" (this one needs to be enabled).
    Also, just as a test, run the web server using the http_net and the v2.06 TCP/IP stack, let's see if the behavior is the same. You could use a standard ESK for this test.
     
     
    #5
    SARATHZARATH
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2019/01/29 04:44:03
    • Location: 0
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/27 02:27:52 (permalink)
    0
    Hi Rainad,
    Sorry I didn't respond, I was having a good time with my family last week :)

    We did take wireshark data while the controller was in hang state, I'll attach wireshark data from both hang and normal states. Here 10.10.6.162 is my PC and 10.10.6.98 is the controller,
    Also during hung state all other functionalities work normally, I was able to ping the controller, heartbeat was working fine, and the alarm services which were in the code were also working correctly.

    I added code for printing "macinfo", "heapinfo", and "tcpinfo" and am waiting for hang condition to happen again.
    but I did take the following data immediately after the controller boot-up.

    HEAP INFO

    Heap type: 1. Initial created heap size: 83920 Bytes
    Allocable block heap size: 12032 Bytes
    All available heap size: 38736 Bytes
    Last heap error: 0x0
    No Trace info exists.
    No heap info exists for type: 2!
    No heap info exists for type: 3!
     
    MAC INFO
    Interface: PIC32INT driver statistics
            nRxOkPackets: 2408, nRxPendBuffers: 1, nRxSchedBuffers: 3, nRxErrorPackets: 0, nRxFragmentErrors: 0
            nTxOkPackets: 1703, nTxPendBuffers: 0, nTxErrorPackets: 0, nTxQueueFull: 0
    Interface: PIC32INT hardware statistics
            FRMTXOK : 0x     6a7
            FRMRXOK : 0x     977
            RXBUFCNT: 0x       2
            RXOVFLOW: 0x       0
            FCSERROR: 0x       0
            ALGNERR : 0x       1
            SCOLFRM : 0x       0
            MCOLFRM : 0x       0
            
     TCP INFO       
    TCP sockets: 10
            sktIx: 0, addType: 0, remotePort: 0, localPort: 80, rxSize: 4000, txSize: 4001, state: 0, rxPend: 0, txPend: 0
            sktIx: 1, addType: 0, remotePort: 0, localPort: 80, rxSize: 4000, txSize: 4001, state: 0, rxPend: 0, txPend: 0
            sktIx: 2, addType: 0, remotePort: 0, localPort: 80, rxSize: 4000, txSize: 4001, state: 0, rxPend: 0, txPend: 0
            sktIx: 3, addType: 0, remotePort: 0, localPort: 80, rxSize: 4000, txSize: 4001, state: 0, rxPend: 0, txPend: 0

     
    I would test the stack v2.06 http_net but I'm short on controllers, but I'll surely do it once the on-going test is completed.
    Thanks.
    post edited by SARATHZARATH - 2019/03/27 02:29:08
    #6
    aschen0866
    Super Member
    • Total Posts : 4416
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/27 07:44:53 (permalink)
    0
    SARATHZARATH

    If we restart our controller everything seems to be working perfectly fine but after few days same issue happens again.


    Your Wireshark capture and this original statement seem to suggest that the sockets on the server side might have been left in the half-open state, hence preventing any further connection to take place.
     
    Your overall approach is susceptible of hacker traffic. We have a HTTP based test server in the DMZ with port 80 open. It is amusing to see so many HTTP GET's from all sort of IP addresses everyday.
    #7
    rainad
    Super Member
    • Total Posts : 1118
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: PIC32 Webserver connection getting lost 2019/03/28 16:36:01 (permalink)
    0
    Not much could be deduced from the heapinfo and macinfo results, since at that time the board was running fine.
    Plus, if you can ping the board fine when this happens, it is clear that the board is not in an out of memory state or the driver is locked up.
    The wireshark log simply shows that the controller board does not respond to the new SYN requests. But it may happen, as suggested by aschen0866, that all the 4 HTTP connections are already somehow busy, and then it's normal that you don't get any reply to new requests.
    What's needed is a wireshark log that captures the moment when this happens, but having some history so we know how the other connections are engaged.
    You could also instrument the code to store a trace of the TCP connections on port 80: what host connected, what time the connection started, and when it was disconnected.
    The stack supports signals for reporting events: TCPIP_TCP_SIGNAL_ESTABLISHED, TCPIP_TCP_SIGNAL_RX_FIN and TCPIP_TCP_SIGNAL_RX_RST, so it should be pretty easy to write a logger that can show what's going on.
     
     
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5