Bug 2128076

Summary: Btrfs send/receive consume all available RAM
Product: [Fedora] Fedora Reporter: Daniel Gonçalves <fedora>
Component: btrfs-progsAssignee: Josef Bacik <josef>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 36CC: bugzilla, davide, esandeen, igor.raits, josef, michel, ngompa13, the.anitazha
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-23 17:20:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Content of journalctl -b none

Description Daniel Gonçalves 2022-09-19 18:47:28 UTC
Description of problem:
I tried to perform a btrfs send/receive with a remote system (over ssh). After executing the command, it will consume more and more RAM until being killed by systemd-oomd. The subvolume size is 22.83GiB and the total system memory is 16GiB.

Version-Release number of selected component (if applicable):
btrfs-progs v5.18
kernel 5.19.9-200.fc36.x86_64
systemd v250.8-1.fc36
openSSH OpenSSH_8.8p1

How reproducible:


Steps to Reproduce:
1.The command used is:
`sudo btrfs send <local_readonly_snapshot> | ssh -i <path_to_key> <host> "sudo btrfs receive <remote_volume>"`
2.on remote system, `sudo btrfs receive` is configured with NOPASSWD.

Actual results:
btrfs is killed by systemd-oomd

Expected results:
snapshot is sent to remote system successfully

Comment 1 Chris Murphy 2022-09-20 05:01:05 UTC
I can't reproduce this on either Fedora 36 or Fedora 37. Can you attach logs? journalctl -b > journal.log will show both kernel and systemd messages.

Comment 2 Daniel Gonçalves 2022-09-20 06:26:49 UTC
Created attachment 1913052 [details]
Content of journalctl -b

Comment 3 Daniel Gonçalves 2022-11-29 20:33:24 UTC
I think I found a way to reproduce this bug. Just try with fish shell and the bug occurs whereas it works like a charm with bash.

Comment 4 Daniel Gonçalves 2023-04-23 17:20:25 UTC
I was finally able to figure out what was going wrong and it's not a btrfs-progs bug. I finally opened an issue on fish project. You can retrieve it here: https://github.com/fish-shell/fish-shell/issues/9747