PDA

View Full Version : Is dbclose broken in all tivosh versions?



BTUx9
04-13-2004, 05:06 AM
dbclose certainly seems to be non-functional in 3.1.1b, and I was wondering if other SW versions were similarly afflicted.

to check, try:

dbclose [dbopen] ; puts [dbhandles]

cojonesdetoro
04-14-2004, 01:17 PM
I have a script that seemed to be leaking file handles but I can't demonstrate it. Every time I closed a file and re-opened it, the file handle increment seemed to increase (file5, file6, file7, etc). It doesn't seem to be consisent though because when I write a smaller script that quickly opens and closes the file, it doesn't happen.

I'm thinking it might be because it's the /var/log/tivoLog.prv file. It gets rotated by the log rotate function. Maybe the file handle can't be released once the file has 'disappeared'.

EDIT: the file was opened for reading only

EDIT: BTW, I'm ssuming you're seeing an ever increasing number of open handles. seems okay on my SA1/3.0 Phllips unit:

Tivo2# tivosh
%
% dbclose [dbopen] ; puts [dbhandles]
db1
% dbclose [dbopen] ; puts [dbhandles]
db1
% dbclose [dbopen] ; puts [dbhandles]
db1
%

What are you seeing?

BTUx9
04-14-2004, 03:01 PM
Tivo2# tivosh
%
% dbclose [dbopen] ; puts [dbhandles]
db1
% dbclose [dbopen] ; puts [dbhandles]
db1I'm seeing the same thing, the handle is still there, even after a dbclose. I've verified that the handle is still valid, which results in the fact that once dbopen is called once, from anywhere in a tivosh program, the program is no longer able to be terminated with a signal without rebooting the tivo.

Another piece of info: it doesn't seem possible to open more than one dbhandle... once dbopen is called, db1 is the handle, period, and won't be reset until you exit tivosh. If anyone knows a way around this (i.e. to make tivosh killable), please let me know.

I have a suspicion this is by design, rather than a bug. If you look at RubbishObjectByFsId, it opens a handle and then doesn't close it. This could be very messy if dbhandles actually worked the way they're supposed to.

cojonesdetoro
04-15-2004, 10:48 AM
Yes, now that you mention it, I remember it being discussed. This was before I started dabbling in TCL so I did not remember it.

That's why a Tivo also reboots when TCL scripts that open the db are killed. The only solution is to have the script respawn after every db access, not very practical for some applications.

EDIT: BTW, If you look at my fxpmerge script, this is what I do. After a DB access I set a variable called 'needrespawn'. The next time the script has been idle for 5 minutes, and the variable has been set, I issue the respawn.

alldeadhomiez
04-15-2004, 12:44 PM
Another piece of info: it doesn't seem possible to open more than one dbhandle... once dbopen is called, db1 is the handle, period, and won't be reset until you exit tivosh. If anyone knows a way around this (i.e. to make tivosh killable), please let me know.

You can force tivosh to disconnect from the event switcher:


event send 19 2 [binary format I* [pid]]

Be on the lookout for unwanted side effects.