Bug 236715

Summary: net/samba48: samba leaves lots of zombie processes around
Product: Ports & Packages Reporter: Alex Richardson <arichardson>
Component: Individual Port(s)Assignee: Timur I. Bakeyev <timur>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (timur)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Alex Richardson freebsd_committer freebsd_triage 2019-03-22 14:02:40 UTC
I am using samba in QEMU (with the -net smb=/path/to/hostdir) to share directories between QEMU and the host.
It seems like samba is spawning a new process every 30 minutes and not reaping it. 

alr48       1066    0.0  0.0       0      0  -  Z    11:51         0:00.00 <defunct>
alr48       1092    0.0  0.0       0      0  -  Z    11:51         0:00.00 <defunct>
alr48       1095    0.0  0.0       0      0  -  Z    11:51         0:00.00 <defunct>
alr48       1697    0.0  0.0       0      0  -  Z    12:06         0:00.00 <defunct>
alr48       2206    0.0  0.0       0      0  -  Z    12:06         0:00.00 <defunct>
alr48       2663    0.0  0.0       0      0  -  Z    12:06         0:00.00 <defunct>
alr48      21569    0.0  0.0       0      0  -  Z    12:21         0:00.00 <defunct>
alr48      22064    0.0  0.0       0      0  -  Z    12:21         0:00.00 <defunct>
alr48      22233    0.0  0.0       0      0  -  Z    12:21         0:00.00 <defunct>
alr48      26734    0.0  0.0       0      0  -  Z    12:36         0:00.00 <defunct>
alr48      26737    0.0  0.0       0      0  -  Z    12:36         0:00.00 <defunct>
alr48      26783    0.0  0.0       0      0  -  Z    12:36         0:00.00 <defunct>
alr48      33804    0.0  0.0       0      0  -  Z    12:51         0:00.00 <defunct>
alr48      33835    0.0  0.0       0      0  -  Z    12:51         0:00.00 <defunct>
alr48      33872    0.0  0.0       0      0  -  Z    12:51         0:00.00 <defunct>
alr48      37798    0.0  0.0       0      0  -  Z    13:06         0:00.00 <defunct>
alr48      37836    0.0  0.0       0      0  -  Z    13:06         0:00.01 <defunct>
alr48      37859    0.0  0.0       0      0  -  Z    13:06         0:00.00 <defunct>
alr48      39687    0.0  0.0       0      0  -  Z    13:21         0:00.00 <defunct>
alr48      39717    0.0  0.0       0      0  -  Z    13:21         0:00.01 <defunct>
alr48      39744    0.0  0.0       0      0  -  Z    13:21         0:00.00 <defunct>
alr48      46892    0.0  0.0       0      0  -  Z    13:36         0:00.01 <defunct>
alr48      46893    0.0  0.0       0      0  -  Z    13:36         0:00.01 <defunct>
alr48      46894    0.0  0.0       0      0  -  Z    13:36         0:00.00 <defunct>
alr48      47110    0.0  0.0       0      0  -  Z    13:51         0:00.00 <defunct>
alr48      47111    0.0  0.0       0      0  -  Z    13:51         0:00.00 <defunct>
alr48      47112    0.0  0.0       0      0  -  Z    13:51         0:00.00 <defunct>
alr48      98399    0.0  0.0       0      0  -  Z    11:36         0:00.01 <defunct>
alr48      98414    0.0  0.0       0      0  -  Z    11:36         0:00.01 <defunct>

All of these processes are children of the smbd process: `/usr/local/sbin/smbd -l /tmp/qemu-smb.7LGXYZ -s /tmp/qemu-smb.7LGXYZ/smb.conf`
I haven't tried building a newer version of samba to see if that bug has been fixed. I will report back once I have done.
Comment 1 Alex Richardson freebsd_committer freebsd_triage 2019-03-22 15:05:07 UTC
I just tried buiding samba 4.10 from source and it seems to have the same problem.

When I run the same command on Linux or macOS I don't see the zombie processes so this must be due to some #ifdefs / configuration options in the samba port that cause processes to be spawned every 30 minutes without reaping them.
Comment 2 Rene Ladan freebsd_committer freebsd_triage 2019-12-15 17:25:10 UTC
net/samba48 expired today, is this relevant for net/samba410?
Comment 3 Alex Richardson freebsd_committer freebsd_triage 2019-12-16 10:10:50 UTC
Yes still present. I've reported it upstream and they can confirm it happens for 4.10: https://bugzilla.samba.org/show_bug.cgi?id=13887#c2.
Comment 4 Alex Richardson freebsd_committer freebsd_triage 2021-01-20 17:33:19 UTC
It appears this is a bad interaction between QEMU/libslirp and samba. Fixed in https://gitlab.freedesktop.org/slirp/libslirp/-/merge_requests/61

Should hopefully arrive in upstream QEMU soon.