[En-Nut-Discussion] Problem with app rs232d.

Paulo da Silva psilva at opensoftware-br.com
Thu Jun 7 15:24:42 CEST 2007


HI Ernst and Dusan,

With yours sugestions I did a several tests with no success.
But I think I found something in that code, I explain below:

I think the problem is not memory  overwriting, because I can have data in
both directions, and the size of this data can be gigabytes, and when I
close the telnet conection and with it closed if I send a char from rs232
terminal, this situation does sistem return to a thread receive and the
memory "malloced" been freed, and when I start a new telnet connection and
type a char into PS rs232 terminal the data is received in PC telnet
application, so the NUS-OS does not crash, I think this prove that it is
impossible the problem be a memory overwritting. I did this for a lot of
times and it always works. But if I close and open a telnet without a
character sent from PC rs232 terminal the Nut-OS crashs all the times I do
that, tested it for a several times too.
Another thing is in the past I was thinking that the quantity of data was
important to this bug, but this is not true.
If I open and close for 10 times a telnet connection with no data trafic,
and after this open one telnet and try to send a character from rs232
terminal, the sistem crashs, againg if I send a character from rs232 to a
telnet with it closed the problem does not appear.

So thanks to Ernst  for your help, but you do not need to do in the weekend,
that test in your board, because the amount of data does not difference.

This problem seems to be that thread receive when it calls StreamCopy , has
a pointer to a socket and it stay bloqued in fread to read data from rs232,
so you close the telnet and open again, but the socket pointer changes the
values, and if you type a char from rs232, when it will do a write to socket
the StreamCopy function has an older pointer that not exist anymore, bang
the sistem crashs, I try to use volatile in the declareation of FILE
*cd_tcpip, but the problem persists.

Any coments about this will be welcome.

regards

Paulo




More information about the En-Nut-Discussion mailing list