These are chat archives for esp8266/Arduino

8th
May 2015
ficeto
@ficeto
May 08 2015 08:52
@igrr did you commit that mDNS change?
ficeto
@ficeto
May 08 2015 10:01
@Links2004 SPI is twice slower for some reason now
ficeto
@ficeto
May 08 2015 10:09
nah... must have been some sort of ESP crap
reflash made it work
ficeto
@ficeto
May 08 2015 10:42
@igrr I notice that network resources are kept in memory for some time, then cleared
they take different amount per connection
do you have a clue where this is defined/controlled
these resources need to be cleared faster
else HEAP might get too low
Markus
@Links2004
May 08 2015 10:44
@ficeto i test it with my logic analyses up to 12Mhz. who do you test it?
ficeto
@ficeto
May 08 2015 10:44
@Links2004 it might have been wrong values on my end
upped the clocks for SD and it's OK now
Markus
@Links2004
May 08 2015 10:51
blob
I recheck the frequency @8MHz all is ok
Ivan Grokhotkov
@igrr
May 08 2015 11:41
@ficeto not commited yet
this is called TIME_WAIT state of TCP connection
it lasts for a minute or so, by the spec
ficeto
@ficeto
May 08 2015 11:42
sure, BUT
Ivan Grokhotkov
@igrr
May 08 2015 11:42
i think the only way around it is to abort tcp connection instead of closing
ficeto
@ficeto
May 08 2015 11:42
HTTP should close the connection and free the resources on end of handle
Ivan Grokhotkov
@igrr
May 08 2015 11:43
yep, but the underlying stack will keep the actual pcb for another minute
the change is quite simple: just comment out tcp_close in ClientContext::unref
ficeto
@ficeto
May 08 2015 11:43
and no way to come around that?
Ivan Grokhotkov
@igrr
May 08 2015 11:43
and leave tcp_abort
but depending on what client you have on the other side, they may treat TCP RST as an error
wget and curl do, for instance
Chrome is okay with that
ficeto
@ficeto
May 08 2015 11:44
I do not want to screw the packets
just close the connection and clear the resources
the next request will be a new connection
Ivan Grokhotkov
@igrr
May 08 2015 11:45
well, you have to understand what it means to "close a TCP connection"
ficeto
@ficeto
May 08 2015 11:45
this is true only for some protocols (like HTTP)
Ivan Grokhotkov
@igrr
May 08 2015 11:45
you can not ask the network stack to just discard the TCP handle
ficeto
@ficeto
May 08 2015 11:45
connection is closing now with FIN
Markus
@Links2004
May 08 2015 11:45
in http you can tell the client to close the connection after transfare
ficeto
@ficeto
May 08 2015 11:45
which is how it should be
but resources are not cleared
so heap goes down
Ivan Grokhotkov
@igrr
May 08 2015 11:45
... and then the connection enters TIME_WAIT state
ficeto
@ficeto
May 08 2015 11:46
imagine AJAX pull every second :(
Ivan Grokhotkov
@igrr
May 08 2015 11:46
in this state the TCP stack has to keep the PCB in case a stray packet comes in
ficeto
@ficeto
May 08 2015 11:46
?
Ivan Grokhotkov
@igrr
May 08 2015 11:46
so yeah, TIME_WAIT is a big issue, not only for ESPs...
Markus
@Links2004
May 08 2015 11:47
have you try to send the "Connection: close" http Header?
ficeto
@ficeto
May 08 2015 11:47
well our computers do not keep it in TIME_WAIT
Ivan Grokhotkov
@igrr
May 08 2015 11:47
please do check the TCP state diagram
ficeto
@ficeto
May 08 2015 11:47
@Links2004 how will it matter? Browser closes fine now
Ivan Grokhotkov
@igrr
May 08 2015 11:48
if one end initiates closing the connection, another end will stay in TIME_WAIT state
Markus
@Links2004
May 08 2015 11:48
if you dont sent the most browser keep the connection alive
Ivan Grokhotkov
@igrr
May 08 2015 11:48
perhaps this one is better:
perhaps fiddling with "Connection: close" can really help us here
ficeto
@ficeto
May 08 2015 11:52
not really
800 bytes lost from heap on refresh
maybe if there was a way to dynamically control TIME_WAIT
and have that down to half a second for certain protocols
Ivan Grokhotkov
@igrr
May 08 2015 11:54
that would put us in violation of TCP spec:)
better to just call tcp_abort at the end of connection
Ivan Grokhotkov
@igrr
May 08 2015 12:02
@ficeto can you please look at the WDT reset which happens when analogWrite is activated?
#189
ficeto
@ficeto
May 08 2015 12:03
will do
Ivan Grokhotkov
@igrr
May 08 2015 12:03
tnx
ficeto
@ficeto
May 08 2015 12:05
probably should not be in RAM or it has issues accessing it's resources