From owner-freebsd-arch Sun Sep 30 19:28:34 2001 Delivered-To: freebsd-arch@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 705F937B40E; Sun, 30 Sep 2001 19:28:31 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 3280C81D01; Sun, 30 Sep 2001 21:28:26 -0500 (CDT) Date: Sun, 30 Sep 2001 21:28:26 -0500 From: Alfred Perlstein To: arch@freebsd.org Cc: iedowse@freebsd.org, wpaul@freebsd.org Subject: RPC over unix domain socket issue. Message-ID: <20010930212826.O59854@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I recently did some work for my employer using FreeBSD+Sun-RPC over a unix domain socket. One of the problems I had was that large responses would fail, the reason being that sendmsg would return EMSGSIZE for transfers that were too big. Basically the workaround for me was to chunk up the responces to smaller PIPEBUF writes. I know PIPEBUF is incorrect, but using getsockopt to fetch SNDBUF returns a value that when used will also EMSGSIZE me. So first off, FreeBSD broken for large RPC responses over unix domain sockets, second, what's the correct thing to do here to avoid the EMSGSIZE without using a bogus very small send size? Is there some interface I need to use to get the max msg size to use? One other thing I noticed was that the client code simply discards any ceredentials it reads, and the server sends them anyway. I was able to change the server to client communication to use simple read/write syscalls and it worked just dandy. Any reason for not doing this? I understand why we might want to check the credentials of the server, but currently the RPC over unix domain sockets doesn't do this, a workaround (if you don't trust the server) is to have your client rpc tell the server to generate a callback to you where you can then check the credentials. So basically we can fix it by either figuring out the max message size and chunking our responces, or we can just switch to using read/write for server->client responces, although that doesn't fix the possiblity of a large request, however that's unlikely unless you're passing large strings around... These bugs are both in the old RPC and the newer tiprc. Any suggestions? I suspect that we may have to fix most of the transport layers to avoid EMSGSIZE not just the unix domain socket transport, but I wanted to get suggestions from the experts. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message