Skip to content

Large file save issue #69

Description

@sheckandar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions