We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi forum users, A few days ago I started struggling with the following problem. When opening three or more concurrent http sessions over a PPP interface my application crashes and the debugger tells me it always happens with the top of the call stack beeing in ppp_send() or ppp_receive() functions.
It seems both those functions fail when trying to allocate some memory by calling alloc_mem(). Suspecting this could have been caused by unproper resources allocation for the whole TcpNet stuff, I tryed raising the memory pool size in NetConfig.c but with no luck. Is such memory really allocated from the TcpNet memory pool or am I on the wrong way?
One more bit. No such effect is visible using concurrent modbus sessions on the same TCP / PPP stack (enabling every available modbus communications however reduces the number of concurrent http sessions I can trigger without crashing). I realize http involves more resources and I still suspect an incorrect sizing for memory. It also seems there is some relationship with the size of the file being transferred by http. Bigger files make the thing crash even with less concurrent http sessions.
A couple questions arise. Can anyone suggest a reasonable rule-of-thumb for choosing a 'safe' memory pool size? I'm using a total of 10 sockets, with max 5 http sessions. No application level protocol is enabled other then http.
And then... is an error allocating memory at the sending/receiving stage of the PPP layer supposed to be a critical error? Could this otherwise be handled by discarding the packet the way we do at MAC level? This is more a confirmation request than a true question, since I suspect some reliability is assumed at that level of the stack.
TIA Regards, Andrea
TCPnet protocol stack is a highly optimized stack and does not consume a lot of dynamic memory. However a PPP addon needs more because the ppp packets are constructed by copying the data into another allocated buffer with PPP encapsulation.
I think that in your case a 16 KByte memory pool would be enough. However you may experiment with the size of the memory pool until you do not get any application hangs.
ANY TCPnet function shall not be called from a different task than the tcp_task. This applies also to main_TcpNet().
Franc