<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hannah Schmidt</title>
    <description>The latest articles on DEV Community by Hannah Schmidt (@hannah_schmidt).</description>
    <link>https://dev.to/hannah_schmidt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4190056%2F541a1b0d-9de0-448b-8f86-2ff19f24d3e9.png</url>
      <title>DEV Community: Hannah Schmidt</title>
      <link>https://dev.to/hannah_schmidt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hannah_schmidt"/>
    <language>en</language>
    <item>
      <title>Notes from a 2 AM On-Call: Why Our Android CI Containers Silently Froze (And the iptables Rule That Fixed It)</title>
      <dc:creator>Hannah Schmidt</dc:creator>
      <pubDate>Sun, 18 Oct 2026 16:16:39 +0000</pubDate>
      <link>https://dev.to/hannah_schmidt/notes-from-a-2-am-on-call-why-our-android-ci-containers-silently-froze-and-the-iptables-rule-that-8pg</link>
      <guid>https://dev.to/hannah_schmidt/notes-from-a-2-am-on-call-why-our-android-ci-containers-silently-froze-and-the-iptables-rule-that-8pg</guid>
      <description>&lt;h1&gt;
  
  
  Notes from a 2 AM On-Call: Why Our Android CI Containers Silently Froze (And the iptables Rule That Fixed It)
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The Failure Symptom
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-10-18 02:14:33 [ERROR] Emulator health check timeout (container: android-worker-3)
2026-10-18 02:14:48 [ERROR] ADB connection refused: 5555 (container: android-worker-7)
2026-10-18 02:15:12 [WARN] Docker exec into android-worker-3: process hangs, no response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our CI pipeline running &lt;code&gt;budtmo/docker-android&lt;/code&gt; for parallel Appium test execution started dropping 40% of jobs at 2 AM UTC when concurrent load spiked from 8 to 24 containers. No crash logs. No OOM kills. Containers appeared healthy in &lt;code&gt;docker ps&lt;/code&gt; but were zombies—ADB refused connections, noVNC showed frozen emulator screens, and &lt;code&gt;docker exec&lt;/code&gt; commands hung indefinitely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Red Herring
&lt;/h2&gt;

&lt;p&gt;Standard Android emulator docs and docker-android examples suggest exposing ADB ports with &lt;code&gt;-p 5555:5555&lt;/code&gt; for host access. Our compose stack did exactly that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;android-worker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;budtmo/docker-android:emulator_11.0&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5555-5578:5555"&lt;/span&gt;  &lt;span class="c1"&gt;# ADB port range for 24 workers&lt;/span&gt;
    &lt;span class="na"&gt;privileged&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Under light load (&amp;lt; 10 concurrent emulators), this worked. At scale, containers froze without kernel panics or resource exhaustion. &lt;code&gt;strace&lt;/code&gt; on the frozen emulator process revealed it was stuck in &lt;code&gt;futex(FUTEX_WAIT)&lt;/code&gt; inside the Android emulator's internal lock—but why?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Root Cause &amp;amp; Runnable Fix
&lt;/h2&gt;

&lt;p&gt;The breakthrough came from a packet capture on the Docker bridge: &lt;strong&gt;external scanners were hitting our exposed ADB port range&lt;/strong&gt;. When an external TCP SYN landed on an emulator's ADB port during emulator boot (a 15-second window), the emulator's ADB daemon entered a race condition in its internal socket accept loop, causing a deadlock in &lt;code&gt;libc&lt;/code&gt;'s mutex.&lt;/p&gt;

&lt;p&gt;budtmo/docker-android containers don't need published ADB ports for internal orchestration—the MCP server and video recorder connect over the Docker bridge network. Publishing them created a 24-port attack surface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 3-line fix&lt;/strong&gt; (added to &lt;code&gt;docker-compose.yml&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;android-worker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;budtmo/docker-android:emulator_11.0&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;android_internal&lt;/span&gt;
    &lt;span class="c1"&gt;# ports: []  # Removed: no published ports&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;EMULATOR_ARGS="-no-snapshot -no-audio -no-window"&lt;/span&gt;

&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;android_internal&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bridge&lt;/span&gt;
    &lt;span class="na"&gt;internal&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;  &lt;span class="c1"&gt;# Allow outbound, block inbound&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plus one &lt;code&gt;iptables&lt;/code&gt; rule on the host to explicitly drop external traffic to the bridge subnet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iptables &lt;span class="nt"&gt;-I&lt;/span&gt; DOCKER-USER &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; 10.0.0.0/8 &lt;span class="nt"&gt;-j&lt;/span&gt; DROP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After deploying, we ran 48-hour soak tests at 32 concurrent containers: &lt;strong&gt;zero freezes&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Invariant Rule
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Never publish container ports unless the host needs direct access.&lt;/strong&gt; Internal service-to-service communication over Docker bridge networks eliminates port conflicts, reduces attack surface, and avoids kernel-level port forwarding race conditions that manifest only under concurrency.&lt;/p&gt;

&lt;p&gt;For production Android CI with budtmo/docker-android: use internal networks, enforce &lt;code&gt;privileged: false&lt;/code&gt; where possible, and place a reverse proxy (Traefik, Nginx) in front of noVNC if browser access is required—never expose raw emulator ports to &lt;code&gt;0.0.0.0&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>linux</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
