-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async Webserver problem #170
Comments
Post your code here, I will have a look. |
I believe the part that is giving problem is this.. String getContentType(String filename) {
if (path.endsWith("&end=end")){ I use this to make the content type etc like the old FS server… void handleNotFound(AsyncWebServerRequest *request) {
} void handleRoot(AsyncWebServerRequest *request) { boolean captivePortal(AsyncWebServerRequest *request) { void t1Callback(); // i would like the sever to be handled here in this function Task t3(100000, TASK_FOREVER, &t3Callback); void loop(void) { when it starts the captive portal it gives this exception code: 18:46:37.649 -> Exception (29): |
First of all, please use the appropriate code quotes - it is difficult to read. |
I tested the Async lib without the task scheduler and kind of worked fine.. .im seeing it give a lot of errors so im investigating what could be the cause… i imagine is because it may get busy in parallel with the tasks… here is the decoded : Exception 29: StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores Decoding stack results |
The setup has this on it: its pretty much like from the original sketch
//First check version of update
if (httpCode == 200 && (http.getString() != "") ) {
//http.end(); |
I still don't see where you add tasks to the scheduler and start them.
It could be the case that you are running execute() on an empty task chain, so it causes a null pointer exception.
It shouldn't, and it may be a bug, but you also should not run an empty task chain, right?
Sent from my mobile implant.
Apologies for autocorrect.
…________________________________
From: sebosfato ***@***.***>
Sent: Saturday, August 19, 2023 6:40:51 PM
To: arkhipenko/TaskScheduler ***@***.***>
Cc: Anatoli Arkhipenko ***@***.***>; Comment ***@***.***>
Subject: Re: [arkhipenko/TaskScheduler] Async Webserver problem (Issue #170)
The setup has this on it: its pretty much like from the original sketch
server.on("/generate_204", handleRoot);
server.on("/fwlink", handleRoot); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
server.onNotFound(handleNotFound);
WHen i try to call this it resets too:
void UPDATE() {
if (memoria==true){
updatecounter++;
if (updatecounter == 1 || updatecounter > 120){
updatecounter=2;
WiFiClient client;
HTTPClient http;
//First check version of update
http.begin(client, "http://xxx/version.php");
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
int httpCode = http.GET(); //Send the request
Serial.println(httpCode); //Print HTTP return code
if (httpCode == 200 && (http.getString() != "") ) {
versaoatual = http.getString();
//versaoatual.trim();
Serial.print("versaoatual ");
Serial.println(versaoatual);
// Serial.println("versao do update mais atual " + versaoatual);
// Serial.println("versao instalada " + String(versao));
// Serial.println ( "float versaoatual " + (String (versaoatual.toFloat())));
http.end();
ESPhttpUpdate.rebootOnUpdate(false);
Serial.println("Update Sketch...");
ESPhttpUpdate.setLedPin(LED, LOW);
t_httpUpdate_return Ret = ESPhttpUpdate.update(client, "http://update.gardentoy.com.br/pro4sfinal/pro4sfinal.ino.bin");
switch (Ret) {
case HTTP_UPDATE_FAILED:
Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break;
case HTTP_UPDATE_NO_UPDATES:
Serial.println("HTTP_UPDATE_NO_UPDATES");
break;
case HTTP_UPDATE_OK:
versao = versaofs;
variavel = "versao";
valor = versao;
POSTDATA();
digitalWrite(LED, LOW);
Serial.println("HTTP_UPDATE_OK");
Serial.println("Updated Sketch ooooookkk...");
EEPROM.put(194, versao); // long - so 8 bytes (next address would be '12')
digitalWrite(LED, LOW);
EEPROM.commit();
Serial.println("HTTP_UPDATE_OK");
Serial.println("versao atualizada" + String(versao));
break;
}
ESP.restart();
} Serial.println("A versao era igual a fonte");
} else { Serial.println("verificar versao falhou ");
}
//http.end();
}else {
Serial.println("ja tentou update");
} }}
—
Reply to this email directly, view it on GitHub<#170 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AACMMTKMEMIYD7XRJAGFCTLXWE6HHANCNFSM6AAAAAA3WXG62I>.
You are receiving this because you commented.Message ID: ***@***.***>
|
This is what I don't see in your sketch. |
I am afraid I will not be able to help you unless you send me full code. |
Im trying to make a resumed version of the code that gives the error and im going to send to you… thanks a lot! im trying to determine the problem and it may seem to be related to also other libraries so im trying to find out too.. I believe it may related to the scheduling of the tasks.. i heard the async webserver run on a task of its own so it could be interesting to find a way to associate with one of the tasks of the scheduler so it can decide when run or up to when it run… i noticed that the wifi manager and update and http requests also is not working so it may also have caused a conflict. I hope it may help others with same problem =) |
OK.
TaskScheduler runs in one thread.
If you need to synchronize tasks from different threads and wait for async execution, it is better to use StatusRequest objects - as they are meant to be event-driven framework for TS.
https://github.com/arkhipenko/TaskScheduler/wiki/Full-Document#6-using-status-request-objects
https://github.com/arkhipenko/TaskScheduler/tree/master/examples/Scheduler_example04_StatusRequest
https://github.com/arkhipenko/TaskScheduler/tree/master/examples/Scheduler_example05_StatusRequest
https://github.com/arkhipenko/TaskScheduler/wiki/API-Status-Request
|
Hello im trying to implemente the async webserver along with the task scheduller
but i seem to have find some exceptions i guess its because it run on background
is there a way to set a task for it?
thanks
The text was updated successfully, but these errors were encountered: