nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32

Home Page:https://nodemcu.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

httpserver: memory leak due to not dropping all references to fifosocket

jpotoniec opened this issue · comments

Expected behavior

Multiple consecutive HTTP GET requests to a httpserver running on a NodeMCU do not cause the platform to OOM and crash.

Actual behavior

Multiple consecutive HTTP GET requests to a httpserver running on a NodeMCU cause crash.

Test code

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

station_cfg={}
station_cfg.ssid="..."
station_cfg.pwd="..."
station_cfg.auto=true
station_cfg.save=false

wifi.setmode(wifi.STATION)
wifi.sta.config(station_cfg)
print(wifi.sta.getip())

require("httpserver").createServer(80, function(req, res)
    res:finish("Error", 500)
end)

After uploading this code issue 100 GET requests (one after another) to the so created server.

NodeMCU startup banner

NodeMCU 3.0.0.0 
	branch: release
	commit: 64bbf006898109b936fcc09478cbae9d099885a8
	release: 3.0-master_20200910
	release DTS: 202009090323
	SSL: false
	build type: float
	LFS: 0x0 bytes total capacity
	modules: adc,bit,dht,file,gpio,i2c,mqtt,net,node,ow,spi,tmr,uart,wifi
 build 2020-10-22 19:48 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)

Hardware

ESP8266 on a LOL1n board. I don't believe this is hardware-specific in any way.