Importing Plex jail failure
I was relocating my jails from one storage pool to another. Shout to digimoot for some good documentation.
When I went to import the Plex jail it failed.
root@ale[~]# iocage import plex -p /mnt/u02/images Importing dataset: plex Importing dataset: plex/root cannot receive: failed to read from stream zsh: killed iocage import plex -p /mnt/u02/images
The problem is the plex jail is 64Gb before exporting 48Gb exported. The database for it should probably be separate from the Jail.
This was the first post that I ran across on this issue
Which led me to discover FreeNAS 11 has a defect. It tries to uncompress the jail root into memory before sending it to ZFS RECV. That's right, we load the 64Gb file into memory (BANG).
This bug still exists in FreeNAS-11.3-U5: /usr/local/lib/python3.7/site-packages/iocage_lib/ioc_image.py
if compression_algo == 'zip': data = f.open(name).read() else: data = f.extractfile(member).read() recv.stdin.write(data) recv.communicate()
This results in running out of swap and the import being terminated. Python3.7 is the IOCAGE command running “iocage import plex”
root@ale[/var/log]# fgrep 'out of swap space' messages Aug 17 07:29:21 ale kernel: pid 67038 (python3.7), jid 0, uid 0, was killed: out of swap space Aug 17 07:29:21 ale kernel: pid 67038 (python3.7), jid 0, uid 0, was killed: out of swap space swap_pager_getswapspace(2): failed swap_pager_getswapspace(2): failed swap_pager_getswapspace(32): failed
Code was fixed in TrueNAS 12 - https://github.com/iocage/iocage/blob/master/iocage_lib/ioc_image.py#L288
chunk_size = 10 * 1024 * 1024 with (f.open(name) if compression_algo == 'zip' else f.extractfile(member)) as file: data = file.read(chunk_size) while data is not None and len(data) > 0: recv.stdin.write(data) data = file.read(chunk_size) recv.communicate()
It has not been backported FreeNAS 11, we will do that ourselves so we can continue to use the “iocage import” process without hacking about with workaround commands.
That worked well.
root@ale[~]# iocage import plex -p /mnt/u02/images Importing dataset: plex Importing dataset: plex/root Imported: plex