I'm trying to add a large file (70 GiB) to a cookfs archive and encountering an issue where tclsh runs out of memory and then is killed by the system.
The file in question is being saved in 4K chunks. The problem is that cookfs never flushes data to disk causing all the data to buffer in RAM. Flush seems to happen only when close $image command is issued.
I have a RedHat 8 system with TCL 9.0.3 and running cookfs from the master branch. The following script showcases the problem.
set cfsid [cookfs::Mount -volume /media/images/test.cfs //test:/]
set image [open //test:/test.img wb]
set device [open /dev/rhel/root rb]
chan configure $device -blocking 0
while {![chan eof $device]} {
set block [chan read $device 4096]
#more code here
chan puts -nonewline $image $block
chan flush $image
}
The file /media/images/test.cfs stays at 0 bytes on disk and the memory usage keeps going up steadily, until all the RAM is used up or close command is issued. The flush command has no effect and neither does setting channel buffering to none.
I'm trying to add a large file (70 GiB) to a cookfs archive and encountering an issue where tclsh runs out of memory and then is killed by the system.
The file in question is being saved in 4K chunks. The problem is that cookfs never flushes data to disk causing all the data to buffer in RAM. Flush seems to happen only when
close $imagecommand is issued.I have a RedHat 8 system with TCL 9.0.3 and running cookfs from the master branch. The following script showcases the problem.
The file /media/images/test.cfs stays at 0 bytes on disk and the memory usage keeps going up steadily, until all the RAM is used up or
closecommand is issued. Theflushcommand has no effect and neither does setting channel buffering to none.