Which esp8266 library version to use?

I started a project using the esp8266 library 2.0.0 (I believe) and it seemingly worked OK.
The target board is an ESP-07 with 1M flash. So I have selected “Generic esp8266 board”.
Later I put my work into subversion and checked out to a new directory for testing, this time the board library setting was not included so I had to do it again and by that time I had forgotten what I had used so I selected the latest 2.4.1 version. (I probably did not correctly select the files to be part of the version control)

Now the project did not build and the error was right inside the library, which of course I can do nothing about.
So then I backed down to the version 2.0.0 and now the sketch verified and could be loaded to the board.

So my question is which version one should use and if there are some problems with sticking to the 2.0.0 library?

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).

Best is to find a solution to the problem so you can use the latest version. There has been a ton of work done since 2.0.0.

There were some features in 2.0.0 that were later removed by Espressif because people were using them for malicious purposes. Maybe you’re one of those people?

I no longer use the 2.4.1 library as described so I cannot inspect the error messages.... Maybe later when I have gotten the main bulk of work done I can check what switching back to 2.4.1 will do. My question was really a general one since I have not used Arduino or the ESP8266 before in a real product. I have mostly done Microchip PIC24 projects using their MPLAB-X dev system.

I wonder why you would need to implicitly accuse me of being a malicious person? Is it likely or on what do you base that?

Now I went from 2.0.0 to 2.4.1 again to see what could be causing my problem, which now is that shortly after a client connects to the module there is a wdt reset! This time I had to set a number of config items before I could use the new library, but the build afterwards succeeded.
So after I uploaded the sketch to the ESP-07 and power cycled it the Wifi AP appeared as normal and I could connect to the network. Then I ran my configuration application, which connects to the config TCP port.
I get a message about this on the serial line.
But then almost immediately the unit resets from the watchdog!
Here is what is shown on the serial line when this happens:

New Config client: 0
Exception (0):
epc1=0xa5a5a5a5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3ffef4f0 end: 3ffefed0 offset: 01a0

>>>stack>>>
3ffef690:  feefeffe 00000000 3ffeebd8 40202c71  
3ffef6a0:  40107338 00000000 00001388 feefeffe  
3ffef6b0:  00000000 3fff192c feefeffe feefeffe  
3ffef6c0:  feefeffe feefeffe feefeffe feefeffe  
3ffef6d0:  feefeffe feefeffe feefeffe feefeffe  
3ffef6e0:  feefeffe feefeffe feefeffe feefeffe  
3ffef6f0:  feefeffe feefeffe feefeffe feefeffe  
3ffef700:  feefeffe feefeffe feefeffe feefeffe  
3ffef710:  feefeffe feefeffe feefeffe feefeffe  
3ffef720:  feefeffe feefeffe feefeffe feefeffe  
3ffef730:  feefeffe feefeffe feefeffe feefeffe  
3ffef740:  feefeffe feefeffe feefeffe feefeffe  
3ffef750:  feefeffe feefeffe feefeffe feefeffe  
3ffef760:  feefeffe feefeffe feefeffe feefeffe  
3ffef770:  feefeffe feefeffe feefeffe feefeffe  
3ffef780:  feefeffe feefeffe feefeffe feefeffe  
3ffef790:  feefeffe feefeffe feefeffe feefeffe  
3ffef7a0:  feefeffe feefeffe feefeffe feefeffe  
3ffef7b0:  feefeffe feefeffe feefeffe feefeffe  
3ffef7c0:  feefeffe feefeffe feefeffe feefeffe  
3ffef7d0:  feefeffe feefeffe feefeffe feefeffe  
3ffef7e0:  feefeffe feefeffe feefeffe feefeffe  
3ffef7f0:  feefeffe feefeffe feefeffe feefeffe  
3ffef800:  feefeffe feefeffe feefeffe feefeffe  
3ffef810:  feefeffe feefeffe feefeffe feefeffe  
3ffef820:  feefeffe feefeffe feefeffe feefeffe  
3ffef830:  feefeffe feefeffe feefeffe feefeffe  
3ffef840:  feefeffe feefeffe feefeffe feefeffe  
3ffef850:  feefeffe feefeffe feefeffe feefeffe  
3ffef860:  feefeffe feefeffe feefeffe feefeffe  
3ffef870:  feefeffe feefeffe feefeffe feefeffe  
3ffef880:  feefeffe feefeffe feefeffe feefeffe  
3ffef890:  feefeffe feefeffe feefeffe feefeffe  
3ffef8a0:  feefeffe feefeffe feefeffe feefeffe  
3ffef8b0:  feefeffe feefeffe feefeffe feefeffe  
3ffef8c0:  feefeffe feefeffe feefeffe feefeffe  
3ffef8d0:  feefeffe feefeffe feefeffe feefeffe  
3ffef8e0:  feefeffe feefeffe feefeffe feefeffe  
3ffef8f0:  feefeffe feefeffe feefeffe feefeffe  
3ffef900:  feefeffe feefeffe feefeffe feefeffe  
3ffef910:  feefeffe feefeffe feefeffe feefeffe  
3ffef920:  feefeffe feefeffe feefeffe feefeffe  
3ffef930:  feefeffe feefeffe feefeffe feefeffe  
3ffef940:  feefeffe feefeffe feefeffe feefeffe  
3ffef950:  feefeffe feefeffe feefeffe feefeffe  
3ffef960:  feefeffe feefeffe feefeffe feefeffe  
3ffef970:  feefeffe feefeffe feefeffe feefeffe  
3ffef980:  feefeffe feefeffe feefeffe feefeffe  
3ffef990:  feefeffe feefeffe feefeffe feefeffe  
3ffef9a0:  feefeffe feefeffe feefeffe feefeffe  
3ffef9b0:  feefeffe feefeffe feefeffe feefeffe  
3ffef9c0:  feefeffe feefeffe feefeffe feefeffe  
3ffef9d0:  feefeffe feefeffe feefeffe feefeffe  
3ffef9e0:  feefeffe feefeffe feefeffe feefeffe  
3ffef9f0:  feefeffe feefeffe feefeffe feefeffe  
3ffefa00:  feefeffe feefeffe feefeffe feefeffe  
3ffefa10:  feefeffe feefeffe feefeffe feefeffe  
3ffefa20:  feefeffe feefeffe feefeffe feefeffe  
3ffefa30:  feefeffe feefeffe feefeffe feefeffe  
3ffefa40:  feefeffe feefeffe feefeffe feefeffe  
3ffefa50:  feefeffe feefeffe feefeffe feefeffe  
3ffefa60:  feefeffe feefeffe feefeffe feefeffe  
3ffefa70:  feefeffe feefeffe feefeffe feefeffe  
3ffefa80:  feefeffe feefeffe feefeffe feefeffe  
3ffefa90:  feefeffe feefeffe feefeffe feefeffe  
3ffefaa0:  feefeffe feefeffe feefeffe feefeffe  
3ffefab0:  feefeffe feefeffe feefeffe feefeffe  
3ffefac0:  feefeffe feefeffe feefeffe feefeffe  
3ffefad0:  feefeffe feefeffe feefeffe feefeffe  
3ffefae0:  feefeffe feefeffe feefeffe feefeffe  
3ffefaf0:  feefeffe feefeffe feefeffe feefeffe  
3ffefb00:  feefeffe feefeffe feefeffe feefeffe  
3ffefb10:  feefeffe feefeffe feefeffe feefeffe  
3ffefb20:  feefeffe feefeffe feefeffe feefeffe  
3ffefb30:  feefeffe feefeffe feefeffe feefeffe  
3ffefb40:  feefeffe feefeffe feefeffe feefeffe  
3ffefb50:  feefeffe feefeffe feefeffe feefeffe  
3ffefb60:  feefeffe feefeffe feefeffe feefeffe  
3ffefb70:  feefeffe feefeffe feefeffe feefeffe  
3ffefb80:  feefeffe feefeffe feefeffe feefeffe  
3ffefb90:  feefeffe feefeffe feefeffe feefeffe  
3ffefba0:  feefeffe feefeffe feefeffe feefeffe  
3ffefbb0:  feefeffe feefeffe 40224d67 00000001  
3ffefbc0:  ffffffff 00000000 3ffe9491 00000008  
3ffefbd0:  40224db6 3ffecad8 3fff06fc 00000001  
3ffefbe0:  3fff15a2 00000000 4010132b 3ffecad8  
3ffefbf0:  000000c0 4021717a 00000008 3fff1588  
3ffefc00:  40223e24 3ffecad8 3ffed250 3fff15a2  
3ffefc10:  00000000 402172e3 3fff09ac 3fff15a2  
3ffefc20:  00000000 00000002 00000001 3ffecad8  
3ffefc30:  3fff15a2 40104f8b 3fff16a0 3fff0ad4  
3ffefc40:  3fff156c feefeffe feefeffe 40104662  
3ffefc50:  3fff156c 40104702 3fff16a0 3fff0ad4  
3ffefc60:  0000002a feefeffe 3ffeedbc 00000000  
3ffefc70:  00000032 0000001c 0000006c 3fff0551  
3ffefc80:  3fff051c 3fff051c 3fff156c 401047c8  
3ffefc90:  4020b913 3fff156c 3fff15a2 4020b91c  
3ffefca0:  00000608 3ffe8f53 feefeffe feefeffe  
3ffefcb0:  000005e0 00000020 401033e5 3ffed4c0  
3ffefcc0:  000005e0 00000020 401033e5 3ffed4c0  
3ffefcd0:  00000000 00000000 00000020 401011e2  
3ffefce0:  3ffe9340 401045c4 3fff176c 3ffed4c0  
3ffefcf0:  00000001 401037e3 3ffed4c0 401011e2  
3ffefd00:  40103c46 0be9a00e 3ffed7a0 401020ce  
3ffefd10:  3ffe9bfc 00000000 00000000 401011e2  
3ffefd20:  4010372a 0000007f 7fffffff 00000000  
3ffefd30:  0000007f 3ffe9bfc 3ffe9bfc 00000001  
3ffefd40:  401025ab 00080000 7fffffff 00000000  
3ffefd50:  00000000 00040000 00000000 4000050c  
3ffefd60:  3fffc278 401022a8 3fffc200 00000022  
3ffefd70:  3ffefd80 40102452 7fffffff 00000000  
3ffefd80:  40204f16 00000030 0000001e ffffffff  
3ffefd90:  40204c27 00000000 3fff00e8 00000000  
3ffefda0:  00000000 00000000 00000000 fffffffe  
3ffefdb0:  00000800 3fffc6fc 00000001 3ffeee98  
3ffefdc0:  00000000 3fffdad0 3ffeeea0 00000030  
3ffefdd0:  40204c10 3ffeeeb0 40204c04 00000000  
3ffefde0:  00000000 00000000 00000000 fffffffe  
3ffefdf0:  ffffffff 3fffc6fc 00000001 3ffeee98  
3ffefe00:  00000000 3fffdad0 3ffeeea0 00000030  
3ffefe10:  00000000 3fffdad0 3ffeeea0 00000030  
3ffefe20:  3ffe84e4 3ffeed84 3fff1534 401009a8  
3ffefe30:  3ffe84e4 3ffeed84 3ffefe78 40204714  
3ffefe40:  3ffe84e4 3ffeed84 3ffeede0 40202ae9  
3ffefe50:  2e323931 2e383631 2e313132 feef0031  
3ffefe60:  00000000 00000000 00000000 401073e0  
3ffefe70:  01d3a8c0 00000000 00000000 00000000  
3ffefe80:  00000000 401073e0 00ffffff feefeffe  
3ffefe90:  3ffeed14 feefeffe feefeffe feefeffe  
3ffefea0:  00000000 00000000 00000001 3ffeeea0  
3ffefeb0:  3fffdad0 00000000 3ffeee98 40204c24  
3ffefec0:  feefeffe feefeffe 3ffeeeb0 40100a2c  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v614f7c32
~ld

Starting TCP <-> UART bridge
Values:
AP SSID = Super9999
AP PWRD = Superxxxx01
AP ADDR = 192.168.211.1
SER BAUD = 38400
SER PORT = 2001
Serialserver ready! Config ready!  Use 192.168.211.1:2001 to connect serial

With 2.0.0 I also had resets but only after a while. One example looked like this and there was no stack output:

New Config client: 0
 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42

What could I do to troubleshoot this problem?

BosseB: I wonder why you would need to implicitly accuse me of being a malicious person?

I didn't "implicitly accuse" you. I asked a question.

BosseB: Is it likely or on what do you base that?

Considering that 99.99% of people using ESP8266 core for Arduino 2.0.0 are doing so to make a "WiFi jammer" that will be used to ruin peoples' day by making their WiFi not work, yes it's a reasonable suspicion. However, your error indicates this is not the case since I believe you would get a completely different error from trying to use the "promiscuous mode" functions in 2.4.1.

BosseB: What could I do to troubleshoot this problem?

Try installing the ESP Exception Decoder, following these instructions: https://github.com/me-no-dev/EspExceptionDecoder#installation Then continuing with the usage instructions. That will give you more information on the case of the problem which you can then post here and hopefully someone will have an answer.

PROBLEM FOUND!
After putting a lot of serial diagnostic output into the code and switching between versions of the SDK I nailed the problem!
As almost always it was a programming error… No blame on the sdk level!
What happened was that I had started from the TCP_UART_Bridge example and explored the ways it worked.
Then I started adding in configuration via the EEPROM store and finally I added in a configuration TCP server on a new port. I copied much of the existing code and created defines for this in the same way as what already existed.
And here I made the copy/paste error by forgetting to change the name of one usage of a define within the config TCP server from the original to the config one.
So in the end the array holding clients was dimensioned with the define for the config max client number (1):

#define MAX_SRV_CLIENTS 2  //how many server clients should be able to communicate this ESP8266
#define MAX_CONF_CLIENTS 1 //How many config clients can simultaneously configure the module?
....
WiFiClient tcpConfigClients[MAX_CONF_CLIENTS]; //<== Array contains 1 element

But then in the loop() function I used the serial server define (2):

	  //check if there are any new Config clients
	  if (tcpConfigSrv->hasClient()) {
	    for (i = 0; i < MAX_SRV_CLIENTS; i++) {  //<== HERE WRONG DEFINE!!! 2 elements
	      //find free/disconnected spot
	      if (!tcpConfigClients[i] || !tcpConfigClients[i].connected()) {
	        if (tcpConfigClients[i]) tcpConfigClients[i].stop();
	        tcpConfigClients[i] = tcpConfigSrv->available();
	        SerialDebug.print("New Config client: "); SerialDebug.println(i);
	        continue;
	      }
	    }
	    //no free/disconnected spot so reject
	    WiFiClient tcpConfigClient = tcpServer->available();
	    tcpConfigClient.stop();
	  }

Unfortunately roundabout that time I had done major dev IDE changes as well and moved from the default 2.0 sdk to 2.4.1 and written a lot of support code before actually uploading the sketch to the ESP. But when I did I did not have the config application written either, which took some time too. The sketch ran fine as it was until I finally connected to the config port when it bombed out with the exception…

Last night when I finally found the cause I had come to sdk level 2.3.0.
Is there any reason not to switch to 2.4.1 now? Is that level more secure in the way it operates?

You can find summary release notes for each version here: https://github.com/esp8266/Arduino/releases Or if you want more detail you can compare the two releases: https://github.com/esp8266/Arduino/compare/2.3.0...2.4.1 Note that it says:

This comparison is big! We’re only showing the most recent 250 commits

so actually you're not getting the full comparison. You would probably need to break it into two comparisons to see the whole thing.

Unfortunately I still have occasional resets at totally irregular times. It can sit idle without resetting for hours on end (overnight too) and then when I am close to it it will suddenly have reset even when I am not touching anything connected to the dev system. At one time I was exchanging the batteries in my keyboard when it reset after having run for over 12 hours. I am currently on the esp firmware level 2.3.0. I will have to check with 2.4.1 if that will help, but it is hard to prove when there is no obvious trigger for the problem like it was with my bug above that triggered the reset 100% of the starts... Is it solved if there is no rest in 24 hours, or a week?...

It could be a hardware issue. The ESP8266 draws a lot of current at times and if you don't provide a good enough power supply this could happen. The other thing you always need to watch out for is that there is a watchdog timer running on the ESP8266. If you don't return from loop(), call delay(), or call yield() regularly then the watchdog times out and resets the microcontroller.

OK, what is the timeout time of the wdt? At all out-of-the-blue reset times I have looked at the report always stated that it was the wdt...

Regarding power I am running on a breadboard with a breadboard adapted power supply plugged into the power rails. I have a 0.1 uF cap soldered right across the ESP power pins on the breakout board and a bigger electrolytic on the breadboard power rails. and the power supply itself is fed from a regulated 12V PS. Should be good on that point.

OTOH at every time I have had this (except when I actually had a code bug causing exception) the resets happened randomly at times with no activity so the loop() should not have gotten stuck anywhere...

Yesterday I switched to library 2.4.1 again and then I let my config app connect to the config port, ran a few commands and went to bed. Now in the morning it all just works as yesterday and there is no reset message on the terminal. And it works ok to communicate with it. So hopefully switching to this latest library has solved the problem.

But not.... >:( While I was working on my computer on something unrelated the ESP-07 reset twice. So it seems like it was OK until about 10-11 hours had passed and then it crashed....