Hi,
I appreciate a lot that you are reading my reports, I can sure use any help I'm getting.
Yes,...
I'm opening the file descriptor at the start of my program and than never close it:
fd = open("/dev/ttyUSB0", O_RDWR);
My home automation program (originally) simply keeps reading from it.
Before each read it did checks whether there was data with a select command.
The fd remains the same, that never changes, so as far as I know nothing increments and reaches a limit
call this as part of forever loop:
{ static char buf[BUFSIZE+1];
fd_set fd_check;
struct timeval wait = {0};
FD_ZERO(&fd_check);
FD_SET(fd, &fd_check);
select(fd+1, &fd_check, NULL, NULL, &wait);
if (FD_ISSET(fd, &fd_check) )
{ j = read(fd, &buf[i], BUFSIZE-i);
... process results...
}
other commands...
}
So.. I think in principle THIS should work, and actually it does on TC15.
However...
You are very right that "if I would open other pipes without closing" I could get in trouble.
Yes.. it's not very safely programmed, it does not include the range check.
I never intentionally keep opening files without closing when I no longer need them.
What I meant is that I open "this specific file" and keep reading without ever closing.
In itself "that is not strange", I'm actively using it.
But if "it collects some garbage over time", it never gets a fresh start.
Anyway, last experiment was to "close & reopen" every 15mins. Its seems that that about doubled the time to crash but it still crashes.
Thanks for the input, I can include a logging on number of fd's when I do a next compilation.
"never intentionally" is different from "absolutely sure I did not"
For now I keep it running. Its 13 hrs down the road now... And it's almost bedtime here. Tomorrow morning I will know whether it at least passed the "15hr average crash milestone"