Skip to content

UDP SYNC broadcast: master device can block itself from receiving any new messages until reboot (ESP8266 not affected) #5929

Open

Description

@softhack007

A WLED sync master should reject notification broadcasts to itself within a short period after sending out the broadcast.

This works as expected on 8266. However in arduino-esp32, WiFiUDP has a different behaviour and the sync master will stop receiving further notifications after the first self-adressed broadcast was rejected. So instead of just returning, the "early reject" path needs to remove the not yet parsed packet explicitly with notifierUdp.flush() (V4 builds) or notifierUdp.clear() (V5 builds).

On 8266, the flush() method does something completely different. So the fix must be guarded with #ifdef ARDUINO_ARCH_ESP32.

I've verified and confirmed the behaviour in arduino-esp32 v2.0.18. Not sure if the V5 builds (arduino-esp32 v3.0.x) are affected, too.

(this ticket was created from a sub-topic in #5924 (comment))

Analysis by the rabbit

Overview

The current 16_x branch still rejects self-originated notifications before consuming the packet at Line 522:

if (!isSupp && notifierUdp.remoteIP() == localIP) return;

In stock 2.0.17, WiFiUDP::parsePacket() returns zero while rx_buffer exists. If a returned broadcast reaches this check, WLED retains the packet and stops draining that socket until something reads, flushes, or closes it.

This can retain one Arduino receive buffer and fill the underlying receive queue.

[....]

I've verified this behavior in both stock Arduino-ESP32 2.0.17 and Tasmota Arduino-ESP32 2.0.18:

  1. parsePacket() stores a received packet in rx_buffer.
  2. The self-originated-packet guard returns without consuming that buffer.
  3. On subsequent calls, parsePacket() returns 0 because rx_buffer still exists. It does not call recvfrom().

Thus, WLED stops processing new packets from notifierUdp until the current buffer is discarded or fully read, or the socket is stopped. The network stack can still queue incoming packets until its receive queue fills. This does not block sending or reception on the other UDP sockets.

The guard should discard the rejected packet:

if (!isSupp && notifierUdp.remoteIP() == localIP) {
  notifierUdp.flush();
  return;
}

In these versions, flush() deletes the current receive buffer. It does not discard all packets queued in the socket. The next parsePacket() call can receive the next queued packet.

This confirms a receive-processing defect. It does not, by itself, establish the cause of the continuing heap loss.

Details

Code Analysis

ESP32: parsePacket() returns 0 when a previous packet was not consumed completely

If the master receives its own notification and the source IP matches Network.localIP(), the guard at Line 522 returns without consuming the packet.

In both Arduino-ESP32 2.0.17 and Tasmota 2.0.18, parsePacket() then returns 0 while that unread receive buffer exists. Therefore:

  • The master stops processing all subsequent incoming packets on notifierUdp, not just its own packets.
  • The master can still send notifications.
  • The supplemental notification socket and RGB socket can still process packets.
  • Reception on notifierUdp resumes if code consumes or discards the buffer, or closes and reopens the socket.

A receive-only client does not trigger this self-packet condition. It can therefore continue processing notifications. However, another unread-packet guard, such as the oversized-packet guard, can also stall that client.

Sending alone does not trigger the stall. The device must receive a packet that reaches the early-return guard. Broadcast delivery and the source-IP comparison determine whether that happens.

So the defect can accidentally produce the “master sends, clients receive” behavior you describe. But it is not a reliable master-mode mechanism. It also prevents legitimate incoming control on that socket.

ESP8266: parsePacket() discards the previous packet

In ESP8266 Arduino Core 3.1.2:

  1. WiFiUDP::parsePacket() calls _ctx->next().
  2. UdpContext::next() discards the previously exposed packet, including unread data.
  3. It advances to the next queued packet, if one exists.

Thus, after WLED rejects its own notification, the next parsePacket() call discards that notification and continues reception. The ESP8266 master does not become receive-disabled through this guard.

Important correction to my previous recommendation

flush() is not portable receive-buffer cleanup:

Framework WiFiUDP::flush() behavior
ESP32 2.0.17 / Tasmota 2.0.18 Deletes the current receive buffer.
ESP8266 3.1.2 Calls endPacket(); it does not discard the received packet.

My earlier notifierUdp.flush() recommendation applies to the inspected ESP32 frameworks only. A shared WLED fix must account for this difference, or explicitly read and discard the rejected packet.

You are interacting with an AI system.

Activity

  1. softhack007 commented on Oct 23, 2026

    @softhack007
    MemberAuthor

    @coderabbitai

    1. please check if "V5" builds (arduino-esp32 v3.0.x) are affected by the same problem
    2. scan the source code in main for other "early return" WiFiUDP receivers that miss to flush the receive buffer.
  2. coderabbitai commented on Oct 23, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    gh issue view 5929 --repo wled/WLED --json title,body,comments
    printf '\n--- revision ---\n'
    git status --short
    git branch --show-current
    git rev-parse HEAD
    git ls-remote origin refs/heads/main
    printf '\n--- UDP receivers and dependencies ---\n'
    rg -n -C3 'parsePacket\s*\(|WiFiUDP|NetworkUDP|arduino-esp32|V5|platform-espressif32' --glob '*.{cpp,h,hpp,c,ini,json,yml,yaml}' --glob '!**/html_ui.h' .

    Length of output: 72366


    🏁 Script executed:

    #!/bin/bash
    for f in wled00/udp.cpp wled00/ntp.cpp usermods/audioreactive/audio_reactive.cpp usermods/Artemis_reciever/usermod.cpp wled00/src/dependencies/espalexa/Espalexa.h; do
      printf '\n--- outline %s ---\n' "$f"
      ast-grep outline "$f" --items all
    done
    printf '\n--- UDP receive ---\n'
    nl -ba wled00/udp.cpp | sed -n '450,755p'
    printf '\n--- NTP receive ---\n'
    nl -ba wled00/ntp.cpp | sed -n '185,390p'
    printf '\n--- Audio receive ---\n'
    nl -ba usermods/audioreactive/audio_reactive.cpp | sed -n '1280,1375p'
    printf '\n--- Artemis receive ---\n'
    nl -ba usermods/Artemis_reciever/usermod.cpp | sed -n '1,180p'
    printf '\n--- Espalexa receive ---\n'
    nl -ba wled00/src/dependencies/espalexa/Espalexa.h | sed -n '345,435p'
    printf '\n--- all receive calls, including other extensions ---\n'
    rg -n -C2 '\b(parsePacket|recvfrom|receivePacket)\s*\(|\b(WiFiUDP|WiFiUDPv6|NetworkUDP|EthernetUDP)\b' --glob '!package-lock.json' --glob '!*.svg' --glob '!*.js' --glob '!*.html' .

    Length of output: 47774


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import urllib.request,re,json,io,zipfile
    for version in ['3.0.0','3.0.7','3.3.8']:
        for path in ['libraries/Network/src/NetworkUdp.cpp','libraries/WiFi/src/WiFiUdp.h']:
            url=f'https://raw.githubusercontent.com/espressif/arduino-esp32/{version}/{path}'
            print('\n---',url,'---')
            try:
                text=urllib.request.urlopen(url).read().decode()
                lines=text.splitlines()
                if path.endswith('.h'):
                    for i,l in enumerate(lines):
                        if 'typedef' in l or 'NetworkUDP' in l: print(f'{i+1}: {l}')
                else:
                    for name in ['parsePacket','read','flush','clear']:
                        for i,l in enumerate(lines):
                            if re.search(r'NetworkUDP::'+name+r'\s*\(',l):
                                j=i+1; depth=l.count('{')-l.count('}')
                                while j<len(lines) and (depth>0 or '{' not in ''.join(lines[i:j])):
                                    depth+=lines[j].count('{')-lines[j].count('}');j+=1
                                print('\n'.join(f'{k+1}: {lines[k]}' for k in range(i,j)))
            except Exception as e: print(type(e).__name__,str(e))
    url='https://github.com/tasmota/platform-espressif32/releases/download/2026.05.50/platform-espressif32.zip'
    print('\n--- platform metadata',url,'---')
    try:
        data=urllib.request.urlopen(url).read()
        z=zipfile.ZipFile(io.BytesIO(data))
        for n in z.namelist():
            if n.endswith('/platform.json') or n=='platform.json':
                obj=json.loads(z.read(n)); print(json.dumps({'version':obj.get('version'),'packages':obj.get('packages')},indent=2))
    except Exception as e: print(type(e).__name__,str(e))
    PY

    Length of output: 16079


    🏁 Script executed:

    #!/bin/bash
    printf '\n--- constants and socket lifecycle ---\n'
    rg -n -C3 '\b(UDP_IN_MAXSIZE|NTP_PACKET_SIZE|NTP_MIN_PACKET_SIZE|UDPSOUND_MAX_PACKET)\b|\b(ntpUdp|fftUdp|rgbUdp|notifierUdp|notifier2Udp)\s*\.\s*(read|flush|clear|stop|begin)\s*\(' --glob '*.{h,cpp,ino}' .
    printf '\n--- remaining legacy receiver outline ---\n'
    ast-grep outline usermods/project_cars_shiftlight/wled06_usermod.ino --items all
    printf '\n--- remaining legacy receiver ---\n'
    nl -ba usermods/project_cars_shiftlight/wled06_usermod.ino | sed -n '1,145p'
    printf '\n--- send-only debug socket ---\n'
    fd -i 'net_debug'
    rg -n -C2 '\bdebugUdp\s*\.' .
    printf '\n--- async receiver ownership ---\n'
    ast-grep outline wled00/src/dependencies/e131/ESPAsyncE131.cpp --items all
    nl -ba wled00/src/dependencies/e131/ESPAsyncE131.cpp | sed -n '20,105p'

    Length of output: 21601


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import urllib.request,re
    url='https://raw.githubusercontent.com/tasmota/arduino-esp32/v3.3.8.260506/libraries/Network/src/NetworkUdp.cpp'
    print('---',url,'---')
    try:
        text=urllib.request.urlopen(url).read().decode()
        lines=text.splitlines()
        for name in ['parsePacket','read','flush','clear']:
            for i,l in enumerate(lines):
                if re.search(r'NetworkUDP::'+name+r'\s*\(',l):
                    j=i+1;depth=l.count('{')-l.count('}')
                    while j<len(lines) and (depth>0 or '{' not in ''.join(lines[i:j])):
                        depth+=lines[j].count('{')-lines[j].count('}');j+=1
                    print('\n'.join(f'{k+1}: {lines[k]}' for k in range(i,j)))
    except Exception as e:
        print(type(e).__name__,str(e))
        # Inspect the exact published framework artifact if the source tag is absent.
        import tarfile,io
        url='https://github.com/tasmota/arduino-esp32/releases/download/v3.3.8.260506/framework-arduinoespressif32.tar.xz'
        print('--- artifact fallback:',url,'---')
        data=urllib.request.urlopen(url).read()
        with tarfile.open(fileobj=io.BytesIO(data),mode='r:xz') as tf:
            for member in tf:
                if member.name.endswith('libraries/Network/src/NetworkUdp.cpp'):
                    lines=tf.extractfile(member).read().decode().splitlines()
                    for i,l in enumerate(lines):
                        if re.search(r'NetworkUDP::(parsePacket|read|flush|clear)\s*\(',l):
                            print('\n'.join(f'{k+1}: {lines[k]}' for k in range(i,min(i+75,len(lines)))))
    PY

    Length of output: 4870


    🏁 Script executed:

    #!/bin/bash
    nl -ba usermods/audioreactive/audio_reactive.cpp | sed -n '1590,1650p'
    rg -n -C3 '\breceiveAudioData\s*\(' usermods/audioreactive/audio_reactive.cpp

    Length of output: 4626


    @softhack007 Yes. V5 builds are affected by the same receive-buffer stall. I also found two additional affected receivers in main.

    I inspected main at 3cdb5108b924ec26dec81d2c92962b70b185bd01. These are source-analysis results, not hardware-test results.

    1. V5 / Arduino-ESP32 3.x

    I checked these framework versions:

    Framework parsePacket() with an unread buffer Receive-buffer cleanup
    Arduino-ESP32 3.0.0 Returns 0 clear() deletes the buffer. flush() does nothing.
    Arduino-ESP32 3.0.7 Returns 0 clear() deletes the buffer. flush() delegates to clear().
    Tasmota Arduino-ESP32 3.3.8.260506 Returns 0 Same behavior as 3.0.7.

    In these versions, WiFiUDP maps to NetworkUDP. A full read() releases the receive buffer. A partial read() leaves the remaining bytes buffered.

    Therefore, the self-broadcast return at wled00/udp.cpp, Line 520 also stalls V5 reception on notifierUdp.

    Use clear() for Arduino-ESP32 3.x. Do not rely on flush() across all 3.0.x versions.

    Sources: 3.0.0 implementation, 3.0.7 implementation, Tasmota implementation.

    Note: main now defaults to Tasmota 3.3.8.260506, rather than 3.0.x, in platformio.ini, Line 323. That version remains affected.

    2. Other affected receive paths in main

    A. Hyperion / raw RGB: early returns leave the whole packet unread

    Location: wled00/udp.cpp, Line 499 and Line 500.

    if (!receiveDirect) return;
    if (packetSize > UDP_IN_MAXSIZE || packetSize < 3) return;

    After rgbUdp.parsePacket() receives a packet:

    • If receiveDirect is false, the first return retains the packet.
    • If the packet contains one or two bytes, the second return retains the packet.

    Either case blocks subsequent reception on rgbUdp. Enabling receiveDirect later does not remove the retained buffer.

    The return for realtimeOverride is safe for this issue. It occurs after the full packet read.

    B. NTP: a partial read retains an extended response

    Location: wled00/ntp.cpp, Line 311.

    ntpUdp.read(pbuf, NTP_PACKET_SIZE);

    NTP_PACKET_SIZE is 48. If a response contains more than 48 bytes, this read leaves its tail buffered. This can happen with NTP extension fields or authentication data.

    The tail remains whether validation rejects the response or accepts it.

    The existing cleanup does not recover from this state:

    • The retry loop at Line 207 / Line 209 requires parsePacket() > 0.
    • The short-packet cleanup at Line 300 / Line 302 requires cb > 0.
    • With a retained tail, parsePacket() returns 0, so both cleanup paths skip it.

    Discard the remaining receive buffer immediately after reading the 48-byte header, before any validation return.

    C. Legacy Artemis receiver: a partial read retains excess payload

    Location: usermods/Artemis_reciever/usermod.cpp, Line 23–29.

    The receiver reads two header bytes, then at most strip.getLengthTotal() * 3 payload bytes.

    If the packet contains more payload than the configured LED count requires, unread bytes remain. Subsequent UDP.parsePacket() calls return 0.

    This is another partial-read defect, rather than an unconditional early-return defect. Discard the remaining packet after the bounded payload read.

    Checked paths that do not have this stall

    • Audio sync: receiveAudioData() skips exactly five-byte packets internally. However, its caller discards the buffer whenever the function returns false. See audio_reactive.cpp, Line 1629–1635. No persistent stall through the current caller.
    • Espalexa: reads the packet and clears the buffer before its discovery-related returns.
    • Project Cars legacy receiver: requests the full reported packet length before filtering by protocol length.
    • E1.31 / Art-Net / DDP input: uses AsyncUDP, not this WiFiUDP receive-buffer mechanism.
    • Later notification-handler returns: occur after the full packet read.

    Oversized-packet guards: conditional concern only

    Line 519 also returns without consuming an oversized notification from either notifier socket. Line 500 does the same for oversized RGB packets.

    However, the inspected ESP32 3.x implementations cap received data at 1460 bytes, below WLED’s 1472-byte limit. Those oversized branches are therefore not reachable with these implementations. They should still discard the selected socket’s packet if a framework with a larger receive limit makes them reachable.

    For the confirmed paths, retain the ESP32-only cleanup guard: use flush() for V4 and clear() for V5. Do not apply ESP32 receive-cleanup semantics to ESP8266.

    You are interacting with an AI system.

  3. softhack007 commented on Oct 23, 2026

    @softhack007
    Author
  4. coderabbitai commented on Oct 23, 2026

    @coderabbitai
  5. softhack007 commented on Oct 23, 2026

    @softhack007
    MemberAuthor

    @coderabbitai please find all other issue tickets that potentially have the same cause.

  6. coderabbitai commented on Oct 23, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    set -euo pipefail
    gh issue view 5929 --repo wled/WLED --json number,title,body,comments
    python - <<'PY'
    import subprocess,json
    queries=[
    'repo:wled/WLED is:issue UDP',
    'repo:wled/WLED is:issue sync',
    'repo:wled/WLED is:issue Hyperion',
    'repo:wled/WLED is:issue NTP',
    'repo:wled/WLED is:issue Artemis',
    'repo:wled/WLED is:issue "0.15.4" "16.0"',
    'repo:wled/WLED is:issue "realtime" "stop"',
    'repo:wled/WLED is:issue "broadcast"',
    ]
    found={}
    for q in queries:
        p=subprocess.run(['gh','api','--method','GET','search/issues','-f','q='+q,'-f','per_page=100'],capture_output=True,text=True)
        if p.returncode:
            print('ERROR',q,p.stderr);continue
        d=json.loads(p.stdout)
        print('\nQUERY',q,'TOTAL',d['total_count'])
        for x in d['items']:
            found[x['number']]=x
            print(json.dumps({k:x.get(k) for k in ['number','title','state','html_url','created_at']},ensure_ascii=False))
    print('\n--- Deduplicated issue bodies ---')
    for n,x in sorted(found.items(),reverse=True):
        print(json.dumps({'number':n,'title':x['title'],'state':x['state'],'body':(x.get('body') or '')[:10000]},ensure_ascii=False))
    PY

    Length of output: 201656


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import json,re,subprocess
    path='/tmp/coderabbit-shell-logs/shell-output-uzDdm8'
    issues={}
    for line in open(path):
        try: x=json.loads(line)
        except Exception: continue
        if isinstance(x,dict) and 'number' in x and 'title' in x and 'body' in x and 'comments' not in x: issues[x['number']]=x
    print('--- Existing search totals ---')
    for line in open(path):
        if line.startswith('QUERY'): print(line.strip())
    print('--- Candidate titles ---')
    rx=re.compile(r'sync|ntp|time.*(wrong|fail|stop)|hyper|udp|realtime|real.time|ambilight|artemis',re.I)
    for n,x in sorted(issues.items(),reverse=True):
        if rx.search(x['title']): print(n,x['state'],x['title'])
    print('--- Recent candidate bodies ---')
    for n,x in sorted(issues.items(),reverse=True):
        if n>=5000 and rx.search(x['title']) and not re.search(r'feature|support|adding|add |allow|coverage|audit|release|metadata',x['title'],re.I):
            print(json.dumps(x,ensure_ascii=False))
    print('--- Complete paginated title searches ---')
    for term in ['sync','UDP','NTP','HyperHDR','time']:
        q=f'repo:wled/WLED is:issue {term} in:title'
        p=subprocess.run(['gh','api','--paginate','--method','GET','search/issues','-f','q='+q,'-f','per_page=100','--jq','.items[] | [.number,.state,.title] | @tsv'],capture_output=True,text=True)
        print('QUERY',q,'\n',p.stdout,p.stderr)
    PY

    Length of output: 48705


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import subprocess,json,re
    nums=[5924,5709,5510,5575,5619,3745,4339,4981,4684,4685,4404,2112,4498,3871,4037,3520,3045,2411,1321,1313,1521,1253,163,4912,1037,1962,4021,1327,1727,3553,4408]
    for n in nums:
        p=subprocess.run(['gh','issue','view',str(n),'--repo','wled/WLED','--json','number,title,state,body,comments'],capture_output=True,text=True)
        if p.returncode: print('ERROR',n,p.stderr);continue
        x=json.loads(p.stdout)
        print('\nISSUE',n,x['state'],x['title'])
        print('BODY',x['body'][:6500])
        for c in x['comments']:
            if c['author']['login'].endswith('[bot]') or c['author']['login']=='coderabbitai': continue
            print('COMMENT',c['author']['login'],c['url'],c['body'][:6500])
    print('\n--- Remaining broad-search pages: relevant titles ---')
    for term,maxpage in [('UDP',3),('sync',6),('NTP',2)]:
        for page in range(2,maxpage+1):
            q=f'repo:wled/WLED is:issue {term}'
            p=subprocess.run(['gh','api','--method','GET','search/issues','-f','q='+q,'-f','per_page=100','-f','page='+str(page)],capture_output=True,text=True)
            if p.returncode: print('ERROR',q,page,p.stderr);continue
            d=json.loads(p.stdout)
            for x in d['items']:
                if re.search(r'sync|ntp|time|hyper|udp|realtime|real.time|ambilight|freeze|receiv|stopp|unrespons',x['title'],re.I):
                    print(json.dumps({'number':x['number'],'title':x['title'],'body':(x.get('body') or '')[:1800]},ensure_ascii=False))
    PY

    Length of output: 201978


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import re,json
    s=open('/tmp/coderabbit-shell-logs/shell-output-oJo3iZ').read()
    for section in re.split(r'\n(?=ISSUE )',s):
        m=re.match(r'ISSUE (\d+)',section)
        if m and int(m[1]) in [163,4912,1037,4021,1327,1727,3553,4408,1521]:
            print(section[:18000])
    tail=s.split('--- Remaining broad-search pages: relevant titles ---')[-1]
    seen=set()
    print('\n--- Additional titles ---')
    for l in tail.splitlines():
        try:x=json.loads(l)
        except:continue
        if x['number'] not in seen:
            seen.add(x['number'])
            print(x['number'],x['title'])
    print('\n--- Additional stall-like bodies ---')
    for l in tail.splitlines():
        try:x=json.loads(l)
        except:continue
        if re.search(r'freez|hang|stop.*(receiv|sync)|receiv.*stop|not.*receiv|unrespons|not work',x['title'],re.I) and x['number'] not in [3745,1327,1521,3045,3871,4037,4981,4685,5333,3528,2147]:
            print(json.dumps(x,ensure_ascii=False))
    PY

    Length of output: 67388


    🏁 Script executed:

    #!/bin/bash
    python - <<'PY'
    import subprocess,json,re
    for n in [3589,2356,3672,5512,3535,3680]:
        p=subprocess.run(['gh','issue','view',str(n),'--repo','wled/WLED','--json','number,title,state,body,comments'],capture_output=True,text=True)
        if p.returncode: print('ERROR',n,p.stderr);continue
        x=json.loads(p.stdout)
        print('\nISSUE',n,x['state'],x['title'],'\nBODY',x['body'][:4500])
        for c in x['comments']:
            if c['author']['login'] in ['coderabbitai','github-actions','stale'] or c['author']['login'].endswith('[bot]'):continue
            print('COMMENT',c['url'],c['body'][:2500])
    for term in ['"rx_buffer"','"parsePacket"','"flush" "UDP"','"HyperHDR"','"receive" "reboot" "sync"','"NTP" "ESP32"']:
        q='repo:wled/WLED is:issue '+term
        p=subprocess.run(['gh','api','--paginate','--method','GET','search/issues','-f','q='+q,'-f','per_page=100','--jq','.items[] | [.number,.title] | @tsv'],capture_output=True,text=True)
        print('\nSEARCH',q,'\n',p.stdout,p.stderr)
    PY

    Length of output: 41075


    @softhack007 I searched open and closed issues for UDP, sync, Hyperion/HyperHDR, NTP, and receive-buffer cleanup. The best additional candidates are #3745 and #163. Several other tickets deserve a check, but none establishes the same cause yet.

    Strongest candidates

    Issue Reported behavior Assessment
    #3745 — ESP32 Sync is not working · Closed ESP32 devices send broadcasts that ESP8266 devices receive. The ESP32 devices do not receive broadcasts. Reported with 0.13.3 and newer. Closest match to the notification-socket defect. ESP32 sending still works, while receiving fails. However, the empty instance list also leaves network filtering as an alternative. The ticket has no buffer-state measurements.
    #163 — Deactivating UDP realtime while hyperion.ng sending data causes WLED to hang · Closed On ESP32, disabling UDP realtime during an active Hyperion stream causes failure until reset. Disabling it without an active stream does not. Closest match to the raw-RGB early-return defect. This exercises the receiveDirect == false rejection path. The reported web-server hang is broader than the socket stall alone explains.
    #1037 — WLED WiFi fails when /win&RD=0 command sent to it · Closed Disabling realtime reception causes failure on ESP32 and ESP8266. Using live override instead avoids the failure. Related historical report, particularly its ESP32 case. Aircoookie explicitly suspected receive-buffer accumulation. The ESP8266 failures cannot be attributed to the ESP32-specific unread-buffer rule.

    The age of #163 and #1037 is relevant. Both predate the framework upgrade in WLED 16.0.0. They support investigating a longstanding cleanup defect, rather than assuming a new Arduino-ESP32 2.x requirement.

    Weaker candidates

    Issue Why it deserves a check Important limitation
    #4404 — 0.15.0 sync issues · Closed Some ESP32 users report complete sync failure despite enabling direct-change notifications and increasing retransmissions. Downgrading restores operation. The discussion contains several different cases. Some users fixed configuration or Wi-Fi problems. Only the unresolved, complete-reception failures are candidates.
    #4981 — Sync not working in 0.15.1 or 0.16 nightly, but works in 0.14.4 · Closed ESP32-C3 reception reportedly fails after an upgrade. The only maintainer response asks the user to enable direct notifications. There is no follow-up that excludes configuration.
    #5619 — Incorrect “relay off” handling when controlled by HyperHDR · Open Later reports say live UDP remains indicated indefinitely, and restarting HyperHDR does not recover control. Low confidence. The ticket does not establish which socket stops receiving. A stalled notification socket does not directly block HyperHDR’s HTTP JSON commands or the separate raw-RGB socket.

    Similar reports that I would keep separate

    • #5709 and #4498 — AP-mode sync failures: These describe failure from the AP master to its clients. In #4498, the reverse direction works. Blocking the master’s receive socket does not directly explain failure of its outgoing notifications.
    • #5575 — HyperHDR delay: Reports include continued reception with seconds of delay, including DDP. This differs from a persistent WiFiUDP receive-buffer stall.
    • #5510 and #5705 — Missing effect options or colors: Other fields still synchronize. These point to state-application defects, not a socket that stops receiving all packets.
    • #4408 — Audio sync stops after 260 seconds: The router-specific timing and successful operation with other routers support a multicast-membership problem. The current audio receiver also has caller-side cleanup.
    • #3535 and #3680 — Hyperion stop/restart failures: These have reported fixes in later firmware. #3680 was fixed through #3731. Similar symptoms do not establish a shared cause.
    • #3672 — Crash during UDP streaming: The discussion identifies a short-packet arithmetic underflow and confirms that guarding it removes the crash.
    • #5924 — Sync-send heap loss: This is the source ticket for #5929, but the receive-buffer defect does not establish the cause of continuing heap loss.

    I found no convincing additional NTP or Artemis ticket for the partial-read defect. The inspected NTP reports mainly concern ESP8266, incorrect timestamps, or time-zone handling.

    Recommended verification order

    Start with #3745, then #163, then the unresolved ESP32 cases in #4404.

    For each affected WiFiUDP socket:

    1. Record the result of the existing parsePacket() call.
    2. Record available() immediately afterward.
    3. If parsePacket() repeatedly returns 0 while available() stays positive, discard the retained packet once.
    4. Check whether reception resumes without rebooting.

    That test would distinguish the cleanup defect from configuration, broadcast delivery, and live-mode state problems.

    This is the candidate list from the searches and discussions I inspected. It is not a confirmed duplicate list, and keyword searches cannot guarantee that every indirectly described report was found.

    You are interacting with an AI system.

  7. changed the title [-]WLED SYNC broadcast: master device blocks itself from receiving any sync messages until reboot (ESP8266 not affected)[/-] [+]WLED UDP broadcast: master device blocks itself from receiving any new messages until reboot (ESP8266 not affected)[/+] on Oct 23, 2026
  8. softhack007 commented on Oct 23, 2026

    @softhack007
    MemberAuthor
    • E1.31 / Art-Net / DDP input: uses AsyncUDP, not this WiFiUDP receive-buffer mechanism.

    @coderabbitai does AsyncUDP require the same cleanup guards, or can it handle unparsed messages gracefully?

  9. coderabbitai commented on Oct 23, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    git rev-parse HEAD
    ast-grep outline wled00/src/dependencies/e131/ESPAsyncE131.cpp --items all
    nl -ba wled00/src/dependencies/e131/ESPAsyncE131.cpp | sed -n '1,230p'
    rg -n -C2 'AsyncUDP|arduino-esp32|framework-arduinoespressif32' platformio.ini wled00/src/dependencies/e131
    python - <<'PY'
    import urllib.request,re
    for version in ['1.0.6','2.0.17','3.0.7']:
        url=f'https://raw.githubusercontent.com/espressif/arduino-esp32/{version}/libraries/AsyncUDP/src/AsyncUDP.cpp'
        print('\nSOURCE',url)
        text=urllib.request.urlopen(url,timeout=30).read().decode()
        lines=text.splitlines()
        needles=['AsyncUDPPacket::~AsyncUDPPacket','AsyncUDPPacket::AsyncUDPPacket','AsyncUDP::_recv','_udp_recv','_udp_task','AsyncUDP::_s_recv']
        hits=set()
        for i,line in enumerate(lines):
            if any(s in line for s in needles):
                hits.update(range(max(0,i-3),min(len(lines),i+65)))
        for i in sorted(hits): print(f'{i+1}: {lines[i]}')
    PY

    Length of output: 57291


    @softhack007 No. ESP32 AsyncUDP does not need the same receive-cleanup guards. A callback can reject a packet with an early return, without reading its payload. The framework releases the packet buffer after the callback returns.

    I checked Arduino-ESP32 1.0.6, 2.0.17, and 3.0.7. All three use the same ownership mechanism:

    1. AsyncUDP::_recv() creates an AsyncUDPPacket and calls the registered callback.
    2. When the callback returns, the packet destructor releases its buffer reference with pbuf_free().
    3. _recv() releases the framework’s remaining buffer reference.

    Packet copies use reference counting. Cleanup does not depend on how many payload bytes the callback reads.

    Sources: 1.0.6 receive path, 2.0.17 receive path, and 3.0.7 receive path.

    Details

    Effect on WLED

    WLED’s ESPAsyncE131::parsePacket() accesses the payload through _packet.data(). It does not drain the packet with read(). That is valid for this API.

    Receiver behavior ESP32 WiFiUDP ESP32 AsyncUDP
    Reject a packet without reading it Requires explicit discard to avoid the retained-buffer stall Automatic cleanup after callback return
    Read only part of a packet Requires discarding the remainder Automatic cleanup after callback return
    Call packet flush() Framework-version-dependent receive cleanup Only advances the packet’s read index in the inspected versions

    Do not add WiFiUDP-style cleanup guards to the E1.31 / Art-Net / DDP callbacks for this issue. Do not manually free the framework-owned payload.

    Two separate constraints still apply:

    • If processing continues after the callback returns, copy the required payload into application-owned storage. Do not retain only the pointer from packet.data().
    • If a callback blocks or processes packets too slowly, it can delay reception and exhaust receive resources. Automatic cleanup does not prevent that problem.

    Thus, an ignored or partially parsed packet does not cause the same unread-buffer stall. This does not guarantee that malformed packets are safe for WLED’s parser; packet-length validation remains a separate requirement.

    These conclusions come from source inspection, not hardware tests.

    You are interacting with an AI system.

  10. coderabbitai commented on Oct 23, 2026

    @coderabbitai
  11. added
    confirmed
    on Oct 23, 2026
  12. changed the title [-]WLED UDP broadcast: master device blocks itself from receiving any new messages until reboot (ESP8266 not affected)[/-] [+]UDP SYNC broadcast: master device blocks itself from receiving any new messages until reboot (ESP8266 not affected)[/+] on Oct 23, 2026
  13. changed the title [-]UDP SYNC broadcast: master device blocks itself from receiving any new messages until reboot (ESP8266 not affected)[/-] [+]UDP SYNC broadcast: master device can block itself from receiving any new messages until reboot (ESP8266 not affected)[/+] on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions