Hello, I've noticed a port leak on buildds when starting a translator. The backtrace of the port allocation is this:
_ports_create_port_internal ports_create_port_noinstall diskfs_start_protid diskfs_create_protid diskfs_S_dir_lookup (libdiskfs/dir-lookup.c:260) _Xdir_lookup What I understand from the diskfs_S_dir_lookup code with my poor libports knowledge: - diskfs_make_peropen (dnp, 0, dircred->po, &newpo) creates a peropen structure "newpo". Its reference counter is initialized to 0. - diskfs_create_portid(newpo, user, &newpi) creates a libport port with receive right. Its reference count is initialized to 1. newpo is made to reference it, its reference counter gets increased to 1. The port right is added to the diskfs_port_bucket portset. - dirport = ports_get_send_right(newpi) adds a port send right to newpi, whose reference counter gets increased to 2. - ports_port_deref(newpi) drops a reference, the counter thus gets back to 1. As I understand it, it's supposed to be the send one. - newpi=0 forgets about the receive part of newpi, only the send part dirport remains. - dirport is given to fshelp_fetch_root(), which copies its send right only. - mach_port_deallocate (mach_task_self(), dirport); release a send right. I'm unsure how the receive part of the kernel port in newpi port is supposed to get deallocated in that scenario, I guess the send right release at the end is supposed to trigger NOTIFY_NO_SENDERS, and libports handles deallocation from that? The thing is that it doesn't seem to happen, thus leaving a port leak here. Any idea? Samuel, who wishes he knew about all that port stuff a lot more...