<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Notebook Error: CANNOT_OPEN_SOCKET in collect() in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5146285#M15786</link>
    <description>&lt;P&gt;hey&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1340679"&gt;@tayloramy&lt;/a&gt;&amp;nbsp;, I have already raised a MSFT ticket as well long back 4 months ago but even they are not able to provide a proper solution for this .&lt;/P&gt;&lt;P&gt;Only recommendation sugessted by them is to apply a retry mechanism in the code when there is a cocket error .&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2026 05:28:37 GMT</pubDate>
    <dc:creator>navakanth_DE</dc:creator>
    <dc:date>2026-04-10T05:28:37Z</dc:date>
    <item>
      <title>Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145128#M15733</link>
      <description>&lt;P&gt;&lt;!--     StartFragment      --&gt;&lt;/P&gt;&lt;P&gt;Hi Fabric community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m running a piece of code in a Fabric notebook that performs a few .collect() and .first() operations on a very small dataset (less than 5 columns). Intermittently, the job fails with a socket error, but a subsequent run often succeeds.&lt;/P&gt;&lt;P&gt;Retry or avoiding collect operations will help but wanted to check the root cause for this error .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a Databricks Community post suggesting this can be caused by a Databricks runtime upgrade&amp;nbsp;(Solved: [CANNOT_OPEN_SOCKET] Can not open socket — Databricks Community #134032)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error message (representative):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;PySparkRuntimeError: pyspark.errors.exceptions.base.PySparkRuntimeError: [CANNOT_OPEN_SOCKET] Can not open socket: ["tried to connect to ('123.4.5.67), but an error occurred: [Errno 104] Connection reset by peer"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone seen this behavior in Fabric notebooks and can suggest likely causes or mitigations?&lt;/P&gt;&lt;P&gt;&lt;!--     EndFragment      --&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 05:34:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145128#M15733</guid>
      <dc:creator>navakanth_DE</dc:creator>
      <dc:date>2026-04-09T05:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: CANNOT_OPEN_SOCKET] Can not open socket error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145159#M15736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not encountered this in my fabric environments before. Can you tell us what your data sources are?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this an issue when reading the data from source, when writing it to a fabric datastore as a target, or is this an issue in processing the data once it's already been loaded to a spark dataframe?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 13:21:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145159#M15736</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2026-04-08T13:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: CANNOT_OPEN_SOCKET] Can not open socket error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145218#M15741</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1340679"&gt;@tayloramy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Getting this error while i am processing the data from a dataframe . For example , read the data from delta lake and trying to get a record using a collect/first function from the dataframe&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 14:33:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145218#M15741</guid>
      <dc:creator>navakanth_DE</dc:creator>
      <dc:date>2026-04-08T14:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145688#M15747</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;The underlying reason for this error is that a Spark action such as .collect() or .first() forces Microsoft Fabric to send results back from the Spark driver and executors into the Python process, and that &lt;STRONG&gt;network connection is being reset while the action is completing&lt;/STRONG&gt;. This is not related to dataset size or faulty code logic, and it can happen even when you are working with very small, simple datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One contributing cause is Fabric’s use of managed, ephemeral compute with autosuspend and background rebalancing. Spark drivers and executors can be paused, recycled, or restarted &lt;STRONG&gt;due to capacity throttling or internal health checks&lt;/STRONG&gt;, sometimes right in the middle of returning results to Python. When that happens, the driver‑to‑Python socket is dropped, which surfaces as a “connection reset by peer” error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another factor is &lt;STRONG&gt;running multiple small Spark actions&lt;/STRONG&gt; in the same notebook. Each .collect() or .first() triggers a separate Spark job and opens a new result channel back to Python, increasing the number of round trips across that fragile boundary. Even though each action is cheap, the cumulative effect makes it more likely that one of those result transfers gets interrupted under capacity pressure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can reduce the likelihood of this issue by minimising round trips to Python and restructuring your code so fewer actions are executed overall. Push as much logic as possible into &lt;STRONG&gt;Spark transformations&lt;/STRONG&gt;, and when you only need a small sample, prefer .take(n) or .limit(n) instead of repeated .collect() calls. If you do need data in Python, &lt;STRONG&gt;aim to do a single, controlled .collect()&lt;/STRONG&gt; at the end rather than many small ones throughout the notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The source of this information has come from Microsoft CoPilot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Apr 2026 19:12:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145688#M15747</guid>
      <dc:creator>deborshi_nag</dc:creator>
      <dc:date>2026-04-09T19:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145938#M15761</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1445078"&gt;@deborshi_nag&lt;/a&gt;&amp;nbsp;- I don't think accepting that "this just happens" and advising users to "do less transformations" is an acceptable answer to this problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;, I've never encountered this myself, but this is very much an issue if this is happening. I'd recommend opening a support ticket with Microsoft, that way they can dig into the telemetry from your tenant and get to the bottom of exactly what is going on, and if there is a bug in the platform, they can get it on the product team's roadmap to fix.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 13:42:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145938#M15761</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2026-04-09T13:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145989#M15764</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1340679"&gt;@tayloramy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;To clarify, I’m not suggesting this behaviour is “acceptable” or expected from a user perspective, nor that the solution is simply to “do less work”.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point I was making is about where the instability is introduced. In Fabric (and other managed Spark services), instability tends to surface specifically at action boundaries, where results are marshalled from the Spark driver back into the Python process over a socket.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using more Spark transformations and fewer actions is not a general performance tip, but a way to reduce exposure to that driver‑to‑Python boundary. Each collect(), first(), or count() opens a new result channel; under capacity pressure or executor recycling, that channel can be reset even for very small datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the mitigation is not “do less transformations”, but batching result materialisation and being deliberate about when data is pulled into Python, until the underlying platform behaviour is improved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Apr 2026 15:02:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5145989#M15764</guid>
      <dc:creator>deborshi_nag</dc:creator>
      <dc:date>2026-04-09T15:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5146285#M15786</link>
      <description>&lt;P&gt;hey&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1340679"&gt;@tayloramy&lt;/a&gt;&amp;nbsp;, I have already raised a MSFT ticket as well long back 4 months ago but even they are not able to provide a proper solution for this .&lt;/P&gt;&lt;P&gt;Only recommendation sugessted by them is to apply a retry mechanism in the code when there is a cocket error .&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2026 05:28:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5146285#M15786</guid>
      <dc:creator>navakanth_DE</dc:creator>
      <dc:date>2026-04-10T05:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5147057#M15802</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Generally it is not advised to use .collect() even while working with small subset of data as this functions holds the result back to the driver memory. The interaction between the driver and workers while transferring the result makes it more slower as compared to other functions like .take() etc. Its is advisable to use .take(), filter by using .limit() function , cache or persist the results and clear spark cache for releasing driver memoery.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 05:57:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5147057#M15802</guid>
      <dc:creator>ati_puri</dc:creator>
      <dc:date>2026-04-16T05:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5148233#M15830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV id="bodyDisplay_5" class=""&gt;
&lt;DIV class=""&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Following up to confirm if the earlier responses addressed your query. If not, please share your questions and we’ll assist further.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&amp;nbsp;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Apr 2026 10:10:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5148233#M15830</guid>
      <dc:creator>v-aatheeque</dc:creator>
      <dc:date>2026-04-14T10:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Notebook Error: CANNOT_OPEN_SOCKET in collect()</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5152358#M15880</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/931831"&gt;@navakanth_DE&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN data-teams="true"&gt;We wanted to follow up to check if you’ve had an opportunity to review the previous responses. If you require further assistance, please don’t hesitate to let us know.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 10:48:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Notebook-Error-CANNOT-OPEN-SOCKET-in-collect/m-p/5152358#M15880</guid>
      <dc:creator>v-aatheeque</dc:creator>
      <dc:date>2026-04-17T10:48:56Z</dc:date>
    </item>
  </channel>
</rss>

