mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1540] Error in setConnectTimeout() #1314
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1314
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rritzi on GitHub (Jan 2, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1540
even if i set _connectTimeout ,my programme keeps handing in the loop and doesnot comeout of it.
@danielminson commented on GitHub (Mar 22, 2023):
I also have this problem
@tablatronix commented on GitHub (Mar 22, 2023):
captiveportaltimeout
@danielminson commented on GitHub (Mar 22, 2023):
Please give a more comprehensive answer. When I try setting wifimanager.setConnectTimeout(30), for example, it simple does not set the value. The debugging says that it is not set.

@tablatronix commented on GitHub (Mar 23, 2023):
sorry you said comeout and I thought you wanted the other timeout to abort the loop.
hmm, that should be working for wifi timeout..
Is your esp getting stuck here for 60seconds? This is a new ESP bug we are looking into.
But connecttimeout should be working, what version you using ?
And is this on autoconnect or wifisave?
@tablatronix commented on GitHub (Mar 23, 2023):
It looks like
github.com/tzapu/WiFiManager@701d58fd07introduced this, but this bug is old, but now the connection code is using NEW all the time as a workaround for esp32 wifiinit #1439@danielminson commented on GitHub (Mar 23, 2023):
This is on autoconnect and it is getting stuck for 60 seconds before saying that the new WiFi connection failed (because of wrong password). I am using latest release(2.0.15-rc.1).
@tablatronix commented on GitHub (Mar 23, 2023):
thanks, I already fixed it. But the esp lib has a bug also. Can you post logs I am working on fixing the ESP bug also
@danielminson commented on GitHub (Mar 23, 2023):
You fixed it for esp32? What logs do you need?
@tablatronix commented on GitHub (Mar 23, 2023):
Sorry, Are you using 8266 or esp32? It should be fixed on both I think.
Any serial logs will be useful.
I need to know the esp logs during the 60seconds of retry, specifically the arduino wifi event error
@danielminson commented on GitHub (Mar 23, 2023):
I am using esp32. How should I get this log? Is there any line of code you can provide me?
@tablatronix commented on GitHub (Mar 23, 2023):
umm if you are using arduino you can enable debugging in the menu I think
@danielminson commented on GitHub (Mar 23, 2023):
I am using platformio.
@tablatronix commented on GitHub (Mar 23, 2023):
ah you can add to your ini/env
build_flags = -DWM_DEBUG_LEVEL=4 -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DCORE_DEBUG_LEVEL=5and add
Serial.debugOutput(true);to code@danielminson commented on GitHub (Mar 27, 2023):
I did it. Cleaned the ESP32 and then put the wrong password for a Wi-Fi network. Here is the debug.
[ 74821][E][WebServer.cpp:649] _handleRequest(): request handler not found
[MEM] free: 241724 | max: 45044 | frag: 82%
*wm:[4] -> captive.apple.com
[MEM] free: 241916 | max: 45044 | frag: 82%
*wm:[2] <- Request redirected to captive portal
[ 74849][W][WebServer.cpp:436] send(): content length is zero
[ 74893][V][WebServer.cpp:296] handleClient(): New client: client.localIP()=192.168.4.1
[ 74894][V][Parsing.cpp:122] _parseRequest(): method: GET url: / search:
[ 74896][V][Parsing.cpp:226] _parseRequest(): headerName: Host
[ 74902][V][Parsing.cpp:227] _parseRequest(): headerValue: 192.168.4.1
[ 74908][V][Parsing.cpp:226] _parseRequest(): headerName: Connection
[ 74914][V][Parsing.cpp:227] _parseRequest(): headerValue: close
[ 74920][V][Parsing.cpp:226] _parseRequest(): headerName: User-Agent
[ 74926][V][Parsing.cpp:227] _parseRequest(): headerValue: CaptiveNetworkSupport-443.40.1 wispr
[ 74934][V][Parsing.cpp:254] _parseArguments(): args:
[ 74939][V][Parsing.cpp:237] _parseRequest(): Request: /
[ 74944][V][Parsing.cpp:238] _parseRequest(): Arguments:
[MEM] free: 241940 | max: 45044 | frag: 82%
*wm:[2] <- HTTP Root
[MEM] free: 241872 | max: 45044 | frag: 82%
*wm:[4] -> 192.168.4.1
[MEM] free: 237860 | max: 45044 | frag: 82%
*wm:[3] [WIFI] reportStatus prev: WL_NO_SSID_AVAIL
[MEM] free: 237872 | max: 45044 | frag: 82%
wm:[3] [WIFI] reportStatus current: WL_DISCONNECTED
[MEM] free: 230200 | max: 45044 | frag: 81%
wm:[2] Scan is cached 682 ms ago
[ 76436][V][WebServer.cpp:296] handleClient(): New client: client.localIP()=192.168.4.1
[ 81440][V][WebServer.cpp:296] handleClient(): New client: client.localIP()=192.168.4.1
[ 81441][V][Parsing.cpp:122] _parseRequest(): method: POST url: /wifisave search:
[ 81445][V][Parsing.cpp:154] _parseRequest(): headerName: Host
[ 81450][V][Parsing.cpp:155] _parseRequest(): headerValue: 192.168.4.1
[ 81456][V][Parsing.cpp:154] _parseRequest(): headerName: Origin
[ 81462][V][Parsing.cpp:155] _parseRequest(): headerValue: http://192.168.4.1
[ 81469][V][Parsing.cpp:154] _parseRequest(): headerName: Content-Type
[ 81475][V][Parsing.cpp:155] _parseRequest(): headerValue: application/x-www-form-urlencoded
[ 81483][V][Parsing.cpp:154] _parseRequest(): headerName: Accept-Encoding
[ 81490][V][Parsing.cpp:155] _parseRequest(): headerValue: gzip, deflate
[ 81496][V][Parsing.cpp:154] _parseRequest(): headerName: Connection
[ 81502][V][Parsing.cpp:155] _parseRequest(): headerValue: keep-alive
[ 81509][V][Parsing.cpp:154] _parseRequest(): headerName: Upgrade-Insecure-Requests
[ 81516][V][Parsing.cpp:155] _parseRequest(): headerValue: 1
[ 81521][V][Parsing.cpp:154] _parseRequest(): headerName: Accept
[ 81527][V][Parsing.cpp:155] _parseRequest(): headerValue: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
[ 81538][V][Parsing.cpp:154] _parseRequest(): headerName: User-Agent
[ 81544][V][Parsing.cpp:155] _parseRequest(): headerValue: Mozilla/5.0 (iPhone; CPU iPhone OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
[ 81559][V][Parsing.cpp:154] _parseRequest(): headerName: Referer
[ 81564][V][Parsing.cpp:155] _parseRequest(): headerValue: http://192.168.4.1/wifi?refresh=1
[ 81573][V][Parsing.cpp:154] _parseRequest(): headerName: Content-Length
[ 81579][V][Parsing.cpp:155] _parseRequest(): headerValue: 17
[ 81585][V][Parsing.cpp:154] _parseRequest(): headerName: Accept-Language
[ 81591][V][Parsing.cpp:155] _parseRequest(): headerValue: en-GB,en-US;q=0.9,en;q=0.8
[ 81599][V][Parsing.cpp:254] _parseArguments(): args: s=Rover&p=wubdbwb
[ 81605][V][Parsing.cpp:272] _parseArguments(): args count: 2
[ 81610][V][Parsing.cpp:280] _parseArguments(): pos 0 =@1 &@7
[ 81616][V][Parsing.cpp:291] _parseArguments(): arg 0 key: s value: Rover
[ 81622][V][Parsing.cpp:280] _parseArguments(): pos 8 =@9 &@-1
[ 81628][V][Parsing.cpp:291] _parseArguments(): arg 1 key: p value: wubdbwb
[ 81635][V][Parsing.cpp:298] _parseArguments(): args count: 2
[ 81640][V][Parsing.cpp:197] _parseRequest(): Plain: s=Rover&p=wubdbwb
[ 81646][V][Parsing.cpp:237] _parseRequest(): Request: /wifisave
[ 81652][V][Parsing.cpp:238] _parseRequest(): Arguments: s=Rover&p=wubdbwb
[MEM] free: 241508 | max: 45044 | frag: 82%
*wm:[2] <- HTTP WiFi save
[MEM] free: 241508 | max: 45044 | frag: 82%
*wm:[3] Method: POST
[MEM] free: 226700 | max: 45044 | frag: 81%
*wm:[3] Sent wifi save page
[MEM] free: 231924 | max: 45044 | frag: 81%
*wm:[2] processing save
[MEM] free: 243036 | max: 45044 | frag: 82%
*wm:[2] Connecting as wifi client...
[MEM] free: 243036 | max: 45044 | frag: 82%
*wm:[3] STA static IP:
[MEM] free: 243036 | max: 45044 | frag: 82%
*wm:[2] setSTAConfig static ip not set, skipping
[MEM] free: 243012 | max: 45044 | frag: 82%
*wm:[1] Connecting to NEW AP: Rover
[MEM] free: 243036 | max: 45044 | frag: 82%
*wm:[3] Using Password: wubdbwb
[MEM] free: 243036 | max: 45044 | frag: 82%
*wm:[3] WiFi_enableSTA enable
[ 83739][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[MEM] free: 242804 | max: 45044 | frag: 82%
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
[ 88638][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: Rover, BSSID: 24:5a:4c:2a:86:59, Reason: 15
[ 88639][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 88646][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 15 - 4WAY_HANDSHAKE_TIMEOUT
[MEM] free: 242408 | max: 45044 | frag: 82%
*wm:[2] [EVENT] WIFI_REASON: 15
The code:
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiManager.h>
void setup() {
// Initialize serial communication
Serial.begin(115200);
Serial.setDebugOutput(true);
// Initialize WiFiManager with a timeout of 15 seconds
WiFiManager wifiManager;
wifiManager.setConnectTimeout(15);
// Uncomment the following line to reset saved settings and erase previous WiFi configuration
//wifiManager.resetSettings();
// Connect to WiFi or start the configuration portal
if (!wifiManager.autoConnect("ESP32")) {
Serial.println("Failed to connect to WiFi and hit timeout");
delay(3000);
// Reset and try again
ESP.restart();
}
// Print the current IP address
Serial.println("Connected to WiFi!");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Your code here
}
@tablatronix commented on GitHub (Mar 27, 2023):
oh so you dont have this issue with correct password ever? I guess this is the same issue, should be working for now
@danielminson commented on GitHub (Mar 27, 2023):
Sometimes it doesn’t connect with correct password, but it think it’s due to lower signal. What do you mean it should be working now?
@tablatronix commented on GitHub (Mar 28, 2023):
I mean there is a workaround in wm for the bug, and the connecttimeout is also fixed
@danielminson commented on GitHub (Mar 28, 2023):
How can I get a version without this issues I am facing then? I am using the latest release…
@tablatronix commented on GitHub (Mar 28, 2023):
you are using git?
@danielminson commented on GitHub (Mar 28, 2023):
Yes, but I am downloading the library from the release page. I think you should make a new release if there are fixes in the git that are not in the latest public release. It would also be nice for updating the library on arduino board manager...

@ramanraja commented on GitHub (Mar 1, 2024):
I still face this issue as of February 2024. I downloaded the latest release from Git. I am using ESP8266.
First I enter the correct password, and connect to the Wifi network successfully. Then I just switch off my WiFi router-modem and restart the ESP. When it is unable to connect to the AP, it goes into a blocking WiFi Manager portal, and never times out.
It never reaches the line
if(!result)..I see on the serial console
@ramanraja commented on GitHub (Mar 2, 2024):
A follow up of the time out issue: I tried non-blocking mode, (appropriately making the wm object global and calling wm.process() in the main loop). There was a different issue this time:
The portal starts all right, but it does not wait for the 3 minute timeout.
Before I could connect to the AP,
wm.autoConnect()returns immediately with a 'false' return value.@tablatronix commented on GitHub (Mar 3, 2024):
This is a bug in esp library. Adding your own connecttimeout will override it. Can you get me debug logs? I have an open issue and they refuse its a real issue
@timf34 commented on GitHub (Mar 5, 2024):
I also have this same issue. AutoConnect gets stuck in a blocking mode if the wrong ap and password are entered.
@tablatronix how would you recommend adding my own setConnectTimeout? I'm not sure how to get past the fact that its blocking.
Thanks