From owner-freebsd-current@FreeBSD.ORG Mon Oct 4 05:49:28 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C551065670; Mon, 4 Oct 2010 05:49:28 +0000 (UTC) (envelope-from daichi@ongs.co.jp) Received: from natial.ongs.co.jp (natial.ongs.co.jp [202.216.246.90]) by mx1.freebsd.org (Postfix) with ESMTP id B30468FC0A; Mon, 4 Oct 2010 05:49:28 +0000 (UTC) Received: from parancell.ongs.co.jp (dullmdaler.ongs.co.jp [202.216.246.94]) by natial.ongs.co.jp (Postfix) with ESMTPSA id 9A87312543B; Mon, 4 Oct 2010 14:49:27 +0900 (JST) Date: Mon, 4 Oct 2010 14:49:27 +0900 From: Daichi GOTO To: freebsd-current@freebsd.org, gcooper@FreeBSD.org, freebsd-fs@freebsd.org Message-Id: <20101004144927.36822f07.daichi@ongs.co.jp> In-Reply-To: References: <20101004123725.65d09b9e.daichi@ongs.co.jp> Organization: ONGS Inc. X-Mailer: Sylpheed 3.0.3 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: Re: fcntl always fails to delete lock file, and PID is always -6464 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 05:49:29 -0000 On Sun, 3 Oct 2010 22:05:12 -0700 Garrett Cooper wrote: > On Sun, Oct 3, 2010 at 8:37 PM, Daichi GOTO wrote: > > It looks very strange. fcntl() always fails to delete lock file > > and command.l_pid is always -6464. This issue is disclosed in > > porting Google's Japanese input system called "mozc". > > > >  details follow: > >    http://code.google.com/p/mozc/issues/detail?id=40 > > > > % uname -a > > FreeBSD parancell.ongs.co.jp 9.0-CURRENT FreeBSD 9.0-CURRENT #6 r213257: Thu Sep 30 10:30:06 JST 2010     root@parancell.ongs.co.jp:/usr/obj/usr/src/sys/PARANCELL  amd64 > > % > > > > My home directory on NFS server.  Does anyone have any ideas? > > > I see some bad assumptions in the code: > > const int result = ::fcntl(*fd, F_SETLK, &command); > if (-1 == result) { // failed > ::close(*fd); > LOG(WARNING) << "already locked"; > return false; // another server is already running > } > > If the developer actually coded to POSIX expectations, he/she > would be checking for EACCES/EAGAIN; there are a myriad of other It was EAGAIN, when I checked. And -6464 is very strange.... It should be -1 when it fails with EGAIN according to FreeBSD fcntl(2) manual. Repeat is easy: # cd /usr/ports/japanese/mozc-server/ # rm files/patch-server_mozc_server.cc # make WITH_DEBUG_CODE=yes install clean % mozc_server ^C --> in this timing, lock files should be deleted, but not working. % mozc_server --> so server will not run and finish soon % % cat ~/.mozc/mozc_server.log > issues that might be occurring with the software, as per my copy of > SUSv4 (see the ERRORS section of fcntl). I would print out the > strerror for that case. > Providing a backtrace of the application's execution and the > architecture and what version of FreeBSD you're using would be > helpful. > Thanks, > -Garrett -- Daichi GOTO CEO | ONGS Inc. 81-42-316-7945 | daichi@ongs.co.jp | http://www.ongs.co.jp LinkedIn: http://linkedin.com/in/daichigoto