(NodeMCU) Exception (3) or Exception (28) while connecting Blynk

I’m getting Exception (3) or Exception (28) time by time, can’t find any reason or explanation.
Hard: NODEMCU V3
Blynk ver: 4.7
arduino-1.8.2-windows
VMicro in VS 2017
Blynk Server: global,
Pinging blynk-cloud.com [188.166.206.43] with 32 bytes of data:
Reply from 188.166.206.43: bytes=32 time=401ms TTL=49
part of programe:

    #include <BlynkSimpleESP8266.h>
    String serverIP = "10.60.223.32";
    WiFiServer server(80);
    WidgetTerminal terminal(V29);
    WidgetBridge bridge1(V61);
    WidgetBridge bridge2(V62);

    void setup()
    {
    	#ifdef DEBUG
    		Serial.begin(115200);
    	#endif	
    	log("");
    	pinMode(_ledQvabi, INPUT); 
    	qvabisStatusi(); // gaigos qvabi Cartulia tu ara
    	pinMode(D4, OUTPUT);
    	pinMode(_ganiaveba, OUTPUT);
    	pinMode(_qvabi, OUTPUT);
    	pinMode(_fancoil, OUTPUT);
    	pinMode(_naxshiri, OUTPUT);
    	pinMode(_mortsyva, OUTPUT);
    	digitalWrite(_fancoil, fancoil);
    	digitalWrite(_naxshiri, naxshiri);
    //	digitalWrite(_qvabi, qvabi);  //  pirdapir chartuls gvaxvedrebs qvabs
    	qvabisLedState = digitalRead(_ledQvabi);
    	qvabisLedStateOld = qvabisLedState;
    	qvabi = qvabisLedState;
    //	qvab(qvabisLedState);  
    	digitalWrite(_ganiaveba, ganiaveba);
    	digitalWrite(_mortsyva, mortsyva);	
    	digitalWrite(D4, 0);
    	WiFi.begin(ssid, pass);
    	while (WiFi.status() != WL_CONNECTED)
    	{
    		delay(500);
    		Serialprint(".");
    	}
        WiFi.setAutoReconnect(true);
    	log("");
            log("WiFi connected; IP address: " + WiFi.localIP().toString());
    	dgeaTuGamea();
    	Blynk.config(auth); 
    	Blynk.connect();  
    	server.begin();
    	digitalWrite(D4, 1);
    	log("____________");
    }

    void loop() 
    {

	

	// check WIFI
	if (!WiFi.isConnected())
	{
		WiFi.reconnect();
		delay(20000);
		if (!WiFi.isConnected()) ESP.restart();
		//		return;
	}
	//check Blynk Internet Connection
	if (Blynk.connected())	{ Blynk.run(); }
	else blynkConAttampt();
    }

Log on Serial :


     0 Day:23:17:04
     -------new client--------
     Client Connecting:
     .................................................................................................................
     client.available time: 3
     client.readStringUntil time: 0
     Request = 02:21,18,9
     02-Request parce time: 0
     Blynk write time: 1479
     0 Day:23:17:20
     Client 01 Request: ip!
     Gadasca CL01: ip=10.60.223.117
     Client 01 Responce: IP-OK
     99-Light; sunnyDay: 1; dayNigh: 1
     0 Day:23:17:37
     Blynk Con. Attampt Interval: 60
     ---Blynk Disconnected! Con.Attampt time: 6
     BLYNK_CONNECTED Start
     Client 02 Request: ip!
     Gadasca CL02: ip=10.60.223.117
     Client 02 Responce: IP-OK
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED END 
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED END 
     BLYNK_CONNECTED Start
     BLYNK_CONNECTED Start
     Exception (3):
     epc1=0x401003e9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x40051469 depc=0x00000000
     ctx: sys 
     sp: 3ffef980 end: 3fffffb0 offset: 01a0
     >>>stack>>>
     3ffefb20:  3ffef368 00000000 00000000 4020122b  
     3ffefb30:  3ffef524 00000000 0000004d 3ffef524  .........
    
    BLYNK_CONNECTED()
    {	
    	log("BLYNK_CONNECTED Start");
    	bridge1.setAuthToken(auth1);
    // Blynk.run();
    	bridge2.setAuthToken(auth2);
    // Blynk.run();
    //	bridge3.setAuthToken(auth3);
    //	Blynk.run();
    //	bridge4.setAuthToken(auth4);
    //	Blynk.run();
    //	bridge5.setAuthToken(auth5);	
    //	sendServerIP(0);        //   internettan dakavSirebisas gadagzavnos Tavisi IP vinicobaa da sheecvala		
    	Blynk.virtualWrite(V30, avtopiloti);
     Blynk.run();
    //	Blynk.setProperty(V30, "label", "ავტოპილოტი");
    // Blynk.run();	
    	
    	Blynk.virtualWrite(V45, avtopiloti2);
    // Blynk.run();
    	if (avtopiloti2)
    	{
    		led44avtopiloti2.on();
    	// Blynk.run();
    		led44avtopiloti2.setColor(Red);
    	// Blynk.run();
    		led44avtopiloti2.setValue(255);
    	}
    	else
    	{
    		led44avtopiloti2.off();
    	// Blynk.run();
    		led44avtopiloti2.setColor(White);
    	// Blynk.run();
    		led44avtopiloti2.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V30, avtopiloti);
    // Blynk.run();
    	if (avtopiloti)
    	{
    		led31avtopiloti.on();
    	// Blynk.run();
    		led31avtopiloti.setColor(Red);
    	// Blynk.run();
    		led31avtopiloti.setValue(255);
    	}
    	else
    	{
    		led31avtopiloti.off();
    	// Blynk.run();
    		led31avtopiloti.setColor(White);
    	// Blynk.run();
    		led31avtopiloti.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V35, mortsyva);
    // Blynk.run();
    	if (mortsyva)
    	{
    		led34mortsyva.on();
    	// Blynk.run();
    		led34mortsyva.setColor(Red);
    	// Blynk.run();
    		led34mortsyva.setValue(255);
    	}
    	else
    	{
    		led34mortsyva.off();
    	// Blynk.run();
    		led34mortsyva.setColor(White);
    	// Blynk.run();
    		led34mortsyva.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V37, ganiaveba);
    // Blynk.run();
    	if (ganiaveba)
    	{
    		led36ganiaveba.on();
    	// Blynk.run();
    		led36ganiaveba.setColor(Red);
    	// Blynk.run();
    		led36ganiaveba.setValue(255);
    	}
    	else
    	{
    		led36ganiaveba.off();
    	// Blynk.run();
    		led36ganiaveba.setColor(White);
    	// Blynk.run();
    		led36ganiaveba.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V41, naxshiri);
    // Blynk.run();
    	if (naxshiri)
    	{
    		led40naxshiri.on();
    	// Blynk.run();
    		led40naxshiri.setColor(Red);
    	// Blynk.run();
    		led40naxshiri.setValue(255);
    	}
    	else
    	{
    		led40naxshiri.off();
    	// Blynk.run();
    		led40naxshiri.setColor(White);
    	// Blynk.run();
    		led40naxshiri.setValue(111);
    	}
     Blynk.run();
    //	Blynk.virtualWrite(V39, qvabi);
    // Blynk.run();
    	if (qvabi)
    	{
    		led38qvabi.on();
    	// Blynk.run();
    		led38qvabi.setColor(Red);
    	// Blynk.run();
    		led38qvabi.setValue(255);
    	}
    	else
    	{
    		led38qvabi.off();
    	// Blynk.run();
    		led38qvabi.setColor(White);
    	// Blynk.run();
    		led38qvabi.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V43, fancoil);
    // Blynk.run();
    	if (fancoil)
    	{
    		led42fancoil.on();
    	// Blynk.run();
    		led42fancoil.setColor(Red);
    	// Blynk.run();
    		led42fancoil.setValue(255);
    	}
    	else
    	{
    		led42fancoil.off();
    	// Blynk.run();
    		led42fancoil.setColor(White);
    	// Blynk.run();
    		led42fancoil.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V25, tvinburgi);
    // Blynk.run();
    	if (tvinburgi)
    	{
    		led24tvinburgi.on();
    	// Blynk.run();
    		led24tvinburgi.setColor(Red);
    	// Blynk.run();
    		led24tvinburgi.setValue(255);
    	}
    	else
    	{
    		led24tvinburgi.off();
    	// Blynk.run();
    		led24tvinburgi.setColor(White);
    	// Blynk.run();
    		led24tvinburgi.setValue(111);
    	}
     Blynk.run();
    	Blynk.virtualWrite(V27, notification);
    // Blynk.run();
    	if (notification)
    	{
    		led26notification.on();
    	// Blynk.run();
    		led26notification.setColor(Red);
    	// Blynk.run();
    		led26notification.setValue(255);
    	}
    	else
    	{
    		led26notification.off();
    	// Blynk.run();
    		led26notification.setColor(White);
    	// Blynk.run();
    		led26notification.setValue(111);
    	}
    // Blynk.run();
    	if (sunnyDay)
    	{
    		led23sunnyDay.on();
    	// Blynk.run();
    		led23sunnyDay.setColor(Red);
    	// Blynk.run();
    		led23sunnyDay.setValue(255);
    	}
    	else
    	{
    		led23sunnyDay.off();
    	// Blynk.run();
    		led23sunnyDay.setColor(White);
    	// Blynk.run();
    		led23sunnyDay.setValue(111);
    	}
     Blynk.run();
    	if (dayNight)
    	{
    		led22dayNight.on();
    	// Blynk.run();
    		led22dayNight.setColor(Red);
    	// Blynk.run();
    		led22dayNight.setValue(255);
    	}
    	else
    	{
    		led22dayNight.off();
    	// Blynk.run();
    		led22dayNight.setColor(White);
    	// Blynk.run();
    		led22dayNight.setValue(111);
    	}
     Blynk.run();
    	if (qvabisLedState)
    	{
    		led21qvabisLedState.on();
    	// Blynk.run();
    		led21qvabisLedState.setColor(Red);
    	// Blynk.run();
    		led21qvabisLedState.setValue(255);
    	}
    	else
    	{
    		led21qvabisLedState.off();
    	// Blynk.run();
    		led21qvabisLedState.setColor(White);
    	// Blynk.run();
    		led21qvabisLedState.setValue(111);
    	}
     Blynk.run();


    //	Blynk.run();
    	//	Blynk.syncVirtual(Vxx);
    	//	Blynk.syncAll();
    	//	Blynk.run();
    	log("BLYNK_CONNECTED END ");
    }

Your explanation is incomplete… no details, hardware, App & library versions, timeframe of error, Cloud or Local server, etc.

You sketch is incomplete… no setup, no defines, no libraries, etc. (and very strange use of Blynk.run(); ummm loops?)

We need more information please :wink:

PS, after a quick Google search, these Exception() errors seem relevant to ESP8266 hardware/software, but not a Blynk specific issue. Try Googling and also checking out some of the solutions mentioned in the ESP forums (basically - bad code).

And I fixed your posted code formatting for proper forum viewing.

@Akakios

Thanks for the updated info… still looks like your ESP is disagreeing with your complex looking code :wink:

Here is a debugger that might help pinpoint the reasons for the exceptions (at least based on quick reading of some Google search results with those exception errors).

Without that Blynk connection was lost often, especially if there was many Blynk.writes and other commands and I find this solution on some forums.

And here is some more readily readable (if not understandable) explanations of those Exception() errors.

https://links2004.github.io/Arduino/dc/deb/md_esp8266_doc_exception_causes.html

This link was already in my Bookmarks :slight_smile: but it is not clear for me what is giving that error.

On the server Nodemcu there is 1500 lines and 40 methods. server receives data(temp, hum, ground hum) from 2 client Nodemcu and switches some relays…
Its Greenhouse Project in one word.
Client side:

void sendDataToServer() 
{
	//	log(THClient.connected());
	//  
		log( "Send data: " + clientID + ":" + String(avT) + ", " + String(avH) + ", " + String(graundHumidity) + ".");
//		lcd.clear();
//		lcd.print(0, 0,String( clientID + ":" + String(avT) + "," + String(avH) + "," + String(graundHumidity) + "."));
		if (THClient.connect(serverIP.c_str(), httpPort))
		{
			if (THClient.connected())
			{
				connectionErorCounter = 0;
				THClient.println(clientID + ":" + String(avT) + "," + String(avH) + "," + String(graundHumidity) + ",.");
//				lcd.print(0, 1, "gaigzavna");
				log("gaigzavna, Host: " + serverIP);
			}
		} else
		{
			connectionErorCounter++; 
//			c++;
//			lcd.print(0, 1, "Con.File:" + String(connectionErorCounter));
			log(String(c) + "-Read error; Connection failed- " + String(connectionErorCounter)); // 
			log("ver gagzavna, Host: " + serverIP);
		}
//		THClient.stop();
}

Server Side:

int timerB = millis(); 

	// Check if a client has connected
	WiFiClient client = server.available();
	if (!client) { return; }
	led = !led; digitalWrite(D4, led);

	log("-------new client--------");
//	 Wait until the client sends some data	
	log("Client Connecting:");
	while (!client.available())
	{
//		delay(1);
		Serialprint(".");
		if (millis() - timerB >1000) { return; }
	}
	
	

	// Read the request	
	String line = client.readStringUntil('.'); 

Yes, a error code that gives a straight answer would be too easy :smiley:

Try that debugger/trace thing I found. That one link shared that the one users issue was a misplaced loop causing the exception error. With only 1500 lines of code, should be a simple fix :stuck_out_tongue_winking_eye:

Thank you very much for help.

Without that Blynk.run(); commands inside Blynk methods connection was lost often, especially if there was many Blynk.writes and other Blynk.commands and I find this solution on some forums.
If this is so bad what can I do not to loose connection to blynk-cloud.com?