<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55743/bad-bsd-socket-behavior---possibly-triggered-by-unexpected-mobile-terminated-tcp-fin</link><description>I&amp;#39;m still trying more TCP stress testing similar to this inquiry . However, now I&amp;#39;m getting highly repeatable lockups on the node I am doing testing with. 
 Application code that has been working fine and reliable for months is now locking up within seconds</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Dec 2019 17:19:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55743/bad-bsd-socket-behavior---possibly-triggered-by-unexpected-mobile-terminated-tcp-fin" /><item><title>RE: Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/thread/226438?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 17:19:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45e9d23e-f119-4bc0-bcb6-8205aeabdf4a</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;Unable to recreate this to get a modem trace yet.&lt;/p&gt;
&lt;p&gt;The modem is now sending a RST packet instead of locking up at step 6, like I would expect.&lt;/p&gt;
&lt;p&gt;Something was definitely different the other day.&amp;nbsp; I&amp;#39;m now trying to remember what other testing I had been doing leading up to the failures, in case one of those tests was somehow a prerequisite for the failure.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still trying...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/thread/226359?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 11:59:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07411242-344c-4233-a3aa-85922022c398</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;According to our modem team, the modem uses a random TCP source port for when a socket bind is not used.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Other than that, we will need a modem trace in order to debug further.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/thread/226209?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 15:45:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d663b89-2425-479e-87ae-3a45e8ecc483</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;MFW 1.1.0 ... BSDLIB 0.5.1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/thread/226208?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 15:44:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fdbd14e-7ec5-4faf-a0df-c4394e1aa56f</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, and thanks for the detailed report.&lt;/p&gt;
&lt;p&gt;I have forwarded it to our modem team and will keep you updated about any progress.&lt;/p&gt;
&lt;p&gt;What modem firmware and bsdlib versions do you use?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bad BSD socket behavior - possibly triggered by unexpected mobile-terminated TCP FIN?</title><link>https://devzone.nordicsemi.com/thread/225973?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 18:46:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:440a29e5-65e2-4ac1-91c0-3369a6a1b9c4</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;As a quick hack, I tried binding the socket to a changing port number after opening it in mqtt_transport_xxx.c.&amp;nbsp; The lockup seems to be gone now.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;d still like some confirmation from someone with visibility into the modem firmware whether my theory is plausible.&lt;/p&gt;
&lt;p&gt;If this does look like the issue, I&amp;#39;d argue that a quick fix would be for the modem firmware to use a changing source port if the application doesn&amp;#39;t specifically bind one.&amp;nbsp; If the current system uses an incrementing port number, maybe just seed it from the RTC on bootup?&amp;nbsp; It doesn&amp;#39;t need to be random, just not the same on every reboot.&lt;/p&gt;
&lt;p&gt;Additionally, some more effort should be made to not fail if an invalid FIN for an ip/port we actually have open shows up, but I understand that might be harder to distinguish.&amp;nbsp; Maybe if the ACK sequence from the server is way out of line you could ignore it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>