<?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>Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111734/modem-error-122-emsgsize-when-downloading-file-over-50kb-via-http-tcp-ipv6-lte-m</link><description>I&amp;#39;m trying to download a largish file (~167KB) via HTTP/TCP/IPv6 but the modem crashes every time around the same point during the download. It&amp;#39;s spits out error 122, which I believe is EMSGSIZE. That would imply that the supplied buffer is too small</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Jun 2024 07:14:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111734/modem-error-122-emsgsize-when-downloading-file-over-50kb-via-http-tcp-ipv6-lte-m" /><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/488021?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 07:14:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7310ae2-8e2b-486c-8935-43ce30da682f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Voxorin"]I didn&amp;#39;t get the download client working due to other errors, 118 &amp;amp; 116 I think it was. [/quote]
&lt;p&gt;That is ETIMEDOUT / EHOSTUNREACH:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr//blob/main/lib/libc/minimal/include/errno.h#L101-L103"&gt;https://github.com/zephyrproject-rtos/zephyr//blob/main/lib/libc/minimal/include/errno.h#L101-L103&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Indicating that there&amp;#39;s a network related issue.&lt;/p&gt;
[quote user="Voxorin"]&lt;p&gt;I don&amp;#39;t have too much time to work on that though. For now I got things working by fragmenting and retrying until the download is complete.&lt;/p&gt;
&lt;p&gt;I have to close the socket and create a new one to stop the issue from happening again immediately. Is there a way to manually clear the offloaded socket receive buffers?&lt;/p&gt;[/quote]
&lt;p&gt;Can you share a modem trace of the issue?&lt;/p&gt;
&lt;p&gt;Clearing the buffers can be done by either reading out via recv() or closing the socket and re-opening it again.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/488000?ContentTypeID=1</link><pubDate>Sun, 09 Jun 2024 16:13:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5bf8176-bcb3-4926-9e6d-bfee5d79599b</guid><dc:creator>Voxorin</dc:creator><description>&lt;p&gt;I didn&amp;#39;t get the download client working due to other errors, 118 &amp;amp; 116 I think it was. I don&amp;#39;t have too much time to work on that though. For now I got things working by fragmenting and retrying until the download is complete.&lt;/p&gt;
&lt;p&gt;I have to close the socket and create a new one to stop the issue from happening again immediately. Is there a way to manually clear the offloaded socket receive buffers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487442?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 08:38:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4daa1532-d504-4f08-b6d6-bfcec9b93e1b</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you test with download_client to verify that you&amp;#39;re able to get that working?&amp;nbsp;If download_client works;&amp;nbsp;you&amp;#39;ll need to effectively re-implement the http parsing in your own application. You can look into the sources for how the download client performs such operations.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487367?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 15:36:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89ede4dc-de66-4164-808c-93f605fe6442</guid><dc:creator>Voxorin</dc:creator><description>&lt;p&gt;How can I resolve this without the download client? I&amp;#39;d like to avoid limiting portability and rewriting too much code.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve reduced the chunks size to 2000KB&amp;lt; and it still gets about 1/3 of the way through the download before giving the EMSGSIZE error. I&amp;#39;m struggling to find the actual cause of the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487317?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 12:23:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a8bb02c-861a-4798-875e-4b3a9b8205e0</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can disable the range request by setting CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS=n.&lt;/p&gt;
&lt;p&gt;Note that this does not allow you to resume a download in case it was interrupted before finishing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487176?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 22:23:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a867b94-e7be-49a4-87a9-9834100474c4</guid><dc:creator>Voxorin</dc:creator><description>&lt;p&gt;There has to be a workaround that doesn&amp;#39;t require 74 GET requests, right? It repeatedly downloads at least 49KB every time&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487167?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 17:48:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7afc0e79-0883-4d97-9650-f3d0f35732a2</guid><dc:creator>Voxorin</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Thanks for pointing me in the right direction. I see the download client uses Content-Range requests to get around the memory constraint.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d like to avoid multiple HTTP requests if possible. Can the issue be avoided if the chunk size is set to 1280 and the receive buffer is processed immediately?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem error 122 (EMSGSIZE) when downloading file over ~50KB via HTTP/TCP/IPv6/LTE-M</title><link>https://devzone.nordicsemi.com/thread/487035?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 07:20:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37268630-bcf1-494e-9c62-6119b5ad97e3</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Based on the port, it looks like you are using a secure connection.&lt;/p&gt;
&lt;p&gt;Secure sockets has a restriction of max. 2k recv limit. Try to reduce the fragment size by setting CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y for instance.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>