Repository navigation
Closed
Labels
sanitizedTitle, body and conversation screened; review text requires separate screening.status: triageNeeds initial assessmenttype: bugSomething is broken
Description
Board / MCU
ESP32
LED Chipset
WS2812B / NeoPixel
FastLED Version
3.10.10
Arduino / PlatformIO version
Arduino 2.3.11
Operating System
Windows
Description
I'm sorry, but there's a problem between FastLED and HTTPS with the latest
version of Fastled 3.10.10 and Expressive version 3.3.12 The connection returns a 200
code on the first loop iteration, but then returns -1.
However, it works with Expressive version 2.0.17 and FastLED version 6.9.0.
Steps to reproduce
yes
Minimal sketch
#include "FastLED.h"
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
WiFiMulti wifiMulti;
const char* ssid = "XXXXXXXXXXX"; // your network SSID (name)
const char* password = "xxxxxxxxxxxxxxxxx"; // your network password
const String host = "https://aviationweather.gov/api/data/metar?format=json&ids=";
// Define Leds
#define No_Stations 35 // Number of Stations also Number of LEDs
#define DATA_PIN 5 // Connect to pin D5/P5 with 330 to 500 Ohm Resistor
#define LED_TYPE WS2812 // WD2811 or WS2812 or NEOPIXEL
#define COLOR_ORDER GRB // WD2811 are RGB or WS2812 are GRB
#define BRIGHTNESS 10 // Master LED Brightness (<12=Dim 20=ok >20=Too Bright/Much Power)
// Define STATIONS & Global Variables
const std::vector<String> Stations { // << Set Up - Do NOT change this line
"NULL, STATION NAME ", // 0 << Reserved - Do NOT change this line
"LPPT, LISBONE, GA ", // 1
"LEMD, MADRID, GA ", // 2
"LEVC, VALENCE, GA ", // 3
"LEBL, BARCELONE, GA ", // 4
"LFBO, TOULOUSE, GA ", // 5
"LFMT, MONTPELLIER, GA ", // 6
"LFTW, UZES NIMES, GA ", // 7
"LFML, MARSEILLE, GA ", // 8
"LFMN, NICE, GA ", // 9
"LFKJ, AJACCIO, GA ", // 10
"LIEE, CAGLIARI, GA ", // 11
"LIRN, NAPLES, GA ", // 12
"LIRP, PISE, GA ", // 13
"LIPZ, VENISE, GA ", // 14
"LIMC, MILAN, GA ", // 15
"LSGG, GENEVE, GA ", // 16
"LFLL, LYON, GA ", // 17
"LFLC, CLERMONT FERRAND, GA ", // 18
"LFPO, ORLY, GA ", // 19
"LFPG, CDG, GA ", // 20
"LFST, STRASBOURG, GA ", // 21
"LSZH, ZURICH, GA ", // 22
"EDDM, MUNICH, GA ", // 23
"EDDF, FRANKFURT, GA ", // 24
"ESGG, GOTEBORG, GA ", // 25
"EHAM, AMSTERDAM, GA ", // 26
"EGLL, LONDRE, GA ", // 27
"EIDW, DUBLIN, GA ", // 28
"LFRC, CHERBOURG, GA ", // 29
"LFRB, BREST, GA ", // 30
"LFRZ, STNAZAIRE, GA ", // 31
"LFBH, LAROCHELLE, GA ", // 32
"LFBD, BORDEAUX, GA ", // 33
"LFBA, AGEN, GA ", // 34
"LFBZ, BIARRITZ, GA ", // 35
};
String metar; // Raw METAR data // << Do NOT change this line
String rem[No_Stations + 1]; // Remarks
String wind[No_Stations + 1]; // wind speed
String category[No_Stations + 1]; // NULL VFR MVFR IFR LIFR
//..............................................Black Green Blue Red Magenta
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED){
delay(300); // Wait a little bit
}
WiFi.mode(WIFI_STA);
wifiMulti.addAP(ssid, password);
}
void loop() {
String urls = "";
for (int j = 1; j <= No_Stations; j++) {
String station = Stations[j].substring(0, 5);
urls = urls + String (station);
}
int len = urls.length();
urls = urls.substring(0, len - 1);
if (wifiMulti.run() == WL_CONNECTED) {
WiFiClientSecure client;
client.setInsecure();
HTTPClient https;
if (https.begin(client, host + urls)) {
https.addHeader("Connection", "close");
metar = "";
int httpCode = https.GET();
Serial.println(httpCode);
if (httpCode == HTTP_CODE_OK) {
metar = https.getString();
}
https.end();
} else {
delay(5000);
return;
}
}
delay(10000);
}Serial / debug output
200
200
-1
-1
-1Checklist
- I have searched existing issues for duplicates
- I have tested with the latest FastLED release or git master
- I can reproduce this with a minimal sketch
Metadata
Metadata
Assignees
Labels
sanitizedTitle, body and conversation screened; review text requires separate screening.status: triageNeeds initial assessmenttype: bugSomething is broken
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 21, 2026
Thanks for the report. Your sketch includes
FastLED.hbut never callsFastLED.addLedsorFastLED.show. In that case FastLED creates no driver, DMA buffer or lock at runtime, so it is unlikely to interfere with HTTPS directly. The upgrade also moved from ESP32 Arduino core 2.0.17 to 3.3.12 at the same time, which is the larger change. To narrow it down, could you:#include "FastLED.h"(and the FastLED library) and check whether the second request still returns -1.ESP.getFreeHeap(),ESP.getMaxAllocHeap()andhttps.errorToString(httpCode). A -1 after the first successful request is often mbedTLS failing to allocate a new session.If the failure only happens with the include present, please attach the full sketch (without credentials), and we will compare the linked hooks and RAM use.
patrice916 commentedon Nov 21, 2026
I’ve found the problem: on the first iteration, the program uses the router’s IPv6 address and it works, but for some reason, it gets stuck afterward.
However, if I use
WiFi.setDNS(1,1,1,1), the issue is resolved—though it’s not a very clean solution.zackees commentedon Nov 21, 2026
Reproduction attempt and root-cause analysis
Summary: I could not get FastLED to cause this. With Arduino-ESP32 3.3.12, the same HTTPS loop returns
200every time, whether or notFastLED.his included, on both FastLED 3.10.10 and current master.What
#include "FastLED.h"changes in your sketchYour sketch never calls
addLeds/show. I built it foresp32devon core 3.3.12 with and without the include and diffed the two linked images:.data+.bss): +20 bytes. FastLED takes no heap away from mbedTLS.CFastLED::CFastLED()and two pointer initialisers. They store constants only. They start no task, no allocation and no hardware.app_main()/loopTask()with a copy ofcores/esp32/main.cpp. The copy skips theSerial0.setPins()call so that sketches which don't use Serial save flash (perf(esp32p4): remove unnecessary Serial0 retention from Arduino framework startup #4892). It creates the loop task with the same stack size (getArduinoLoopTaskStackSize()/8192), priority and core as stock. This only applies on 3.3.x, which is why it lines up with your core upgrade, so I tested it directly.Hardware A/B test
ESP32-C6, Arduino-ESP32 3.3.12 (pioarduino 55.03.312). An on-device
esp_https_serveron127.0.0.1returns a 16 KB body. Your client code runs unchanged against it:WiFiClientSecure+setInsecure(),HTTPClient,Connection: close, and the body kept in a globalString. 10 requests per build:app_main/loopTask200flLoopTask200flLoopTask200I confirmed with
nmthat the FastLED images really ran FastLED's startup (fl_esp32_arduino_app_main,flLoopTask). Free heap drops by about 250 B per request in all three builds, including the one without FastLED. That leak is in the core/TLS stack, not in FastLED.Root cause
This is not a FastLED defect. The failure comes from the ESP32 Arduino core upgrade from 2.0.17 to 3.3.12 (ESP-IDF 4.4 to 5.5, including a new mbedTLS version), which your report changed at the same time.
200, 200, -1isHTTPC_ERROR_CONNECTION_REFUSED:WiFiClientSecure::connect()failed. Over the internet on a classic ESP32 this usually means the TLS handshake could not allocate its buffers. aviationweather.gov sends an RSA certificate chain and a large JSON reply, and the classic ESP32 has much less free heap with WiFi STA running than the C6 above. This part is a hypothesis. I have no classic ESP32 with internet access to confirm it, so the numbers below would settle it.Next steps
app_main/loopTask, and it works from the Arduino IDE (no build flags needed):-1still happens, FastLED's startup code is not involved.ESP.getFreeHeap()andESP.getMaxAllocHeap(), and printhttps.errorToString(httpCode)after it. Also callclient.lastError(buf, sizeof buf)on theWiFiClientSecureto get the mbedTLS error.-0x7F00(MBEDTLS_ERR_SSL_ALLOC_FAILED) or a max-alloc below ~40 KB confirms heap exhaustion.metarwithmetar.reserve(...)once, or parse the stream directly withhttps.getStream()instead ofgetString(). You can also tryclient.setTimeout()/https.setReuse(false).FastLED is adding a note to the docs so the opt-out in step 1 is easier to find.
docs(esp32): opt-out define is per file; list gate conditions (#5365)
zackees commentedon Nov 22, 2026
Correction to my previous comment, step 1. On a closer check,
#define FL_ESP32_STOCK_ARDUINO_MAIN 1in the sketch is not enough in the Arduino IDE. FastLED's own library objects also define the weakapp_main, and the Arduino IDE links library.ofiles directly. FastLED's startup therefore stays in the image whatever the sketch defines. (Under PlatformIO/fbuild the library is linked as an archive, so the define works there. That is where I verified it.) This is a FastLED bug and I'm fixing it now. I'll post here when the fix lands. The A/B test results in the previous comment still stand: FastLED's startup made no difference to the HTTPS loop on core 3.3.12. Steps 2 and 3 (heap numbers andlastError) are still the quickest way to pin down your-1.fix(esp32): keep weak app_main out of FastLED library objects (#5365)
fix(esp32): only keep app_main out of library objects (#5365)
zackees commentedon Nov 22, 2026
The fix for the opt-out landed in #5385 (master
9ae863e34). FastLED's own library objects no longer contain the weakapp_main. In the Arduino IDE (using FastLED master until the next release), this line now restores the core's stock startup:Put it before
#include "FastLED.h"in every sketch file that includes FastLED. I checked it on an ESP32-C6 with core 3.3.12: with the define, the image links the core's ownapp_main/loopTask. Without it, the image uses FastLED's startup as before.On your
-1: the A/B test above found no FastLED effect, so the cause is most likely the core 2.0.17 → 3.3.12 change on a classic ESP32 (TLS heap). The define lets you confirm that on your board. Please post theESP.getMaxAllocHeap()andclient.lastError()output from the earlier comment if it still fails.zackees commentedon Nov 22, 2026
Tracking note: this is the same report as #5010 (closed; its follow-up replies from 2026-11-21 are answered there now), #5091 and #5092. This issue is the single open thread for it.
Background from #5010: an ESP32 C++ guard defect (#4994) was fixed by #5007, and a later test passed 160 HTTPS requests on an ESP32dev with core 3.3.11. Neither reproduced the 200-then-
-1failure. The reporter's replies show it still happens with #5007 included (master and 3.10.10, core 3.3.12), so that defect was not the cause. Next step is the reporter's heap andlastError()numbers, withFL_ESP32_STOCK_ARDUINO_MAINset to rule out FastLED's startup code.fix(esp32): keep weak app_main out of FastLED library objects so the …
test(esp32): assert weak app_main sits inside the library guard (Fast…
patrice916 commentedon Nov 22, 2026
zackees commentedon Nov 22, 2026
Thanks for tracking it down. Your result fits what we measured: the first request works, then DNS lookups through the router (Livebox) IPv6 resolver stop, and
connect()fails with-1. That comes from DNS on the network/core side, not from FastLED. Our A/B test gave 10/10200with and without FastLED on core 3.3.12.WiFi.setDNS(...)is a valid fix. Calling it once afterWiFi.begin()/connect should be enough, so it doesn't need to run every loop.Separately, #5385 fixed the
FL_ESP32_STOCK_ARDUINO_MAINopt-out for Arduino IDE builds, and #5392 adds a regression test for it.Closing; please reopen if it comes back with a fixed DNS server. Merci / thanks!