From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 11 15:02:00 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DA3E106564A; Wed, 11 Jan 2012 15:02:00 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 34F0F8FC08; Wed, 11 Jan 2012 15:01:59 +0000 (UTC) Received: by yhfq46 with SMTP id q46so362729yhf.13 for ; Wed, 11 Jan 2012 07:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=kfoQUaNb8cfSWSsmoRuBuRVBfK7axGGu2TXpZKYdt50=; b=Y3LXNiloRe6DD3amTNZAcoobDcF9qk0B2UmCnMocXCu09BTHYQmNce152s2WN/ZlEn y/m3f00UAhnC/kKpwWPsdcwKNAGW4cXo9DDpgBGTWSi09GmsShSWvg7iCb68RP56J06E 2buROt9lTmZremVsOW1oZhKehYDz4YYGcYScg= Received: by 10.236.139.199 with SMTP id c47mr31753460yhj.113.1326292451156; Wed, 11 Jan 2012 06:34:11 -0800 (PST) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.100.214.14 with HTTP; Wed, 11 Jan 2012 06:33:30 -0800 (PST) In-Reply-To: <201201110806.30620.jhb@freebsd.org> References: <201201110806.30620.jhb@freebsd.org> From: Ivan Voras Date: Wed, 11 Jan 2012 15:33:30 +0100 X-Google-Sender-Auth: 5e2Q9teYIR8MmbZr6sD50-eF-Qs Message-ID: To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, davidxu@freebsd.org Subject: Re: sem(4) lockup in python? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 15:02:00 -0000 On 11 January 2012 14:06, John Baldwin wrote: > On Wednesday, January 11, 2012 6:21:18 am Ivan Voras wrote: >> The lang/python27 port can optionally be built with the support for >> POSIX semaphores - i.e. sem(4). This option is labeled as experimental >> so it may be that the code is simply incorrect. I've tried it and get >> frequent hangs with the python process in the "usem" state. The kernel >> stack is as follows and looks reasonable: >> >> # procstat -kk 19008 >> =C2=A0 =C2=A0PID =C2=A0 =C2=A0TID COMM =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 TDNAME =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 KSTACK >> >> 19008 101605 python =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mi_switch+0x174 >> sleepq_catch_signals+0x2f4 sleepq_wait_sig+0x16 _sleep+0x269 >> do_sem_wait+0xa19 __umtx_op_sem_wait+0x51 amd64_syscall+0x450 >> Xfast_syscall+0xf7 >> >> The process doesn't react to SIGINT or SIGTERM but fortunately reacts to >> SIGKILL. >> >> This could be an error in Python code but OTOH this code is not >> FreeBSD-specific so it's unlikely. > > This is using the new umtx-based semaphore code that David Xu wrote. =C2= =A0He is > probably the best person to ask (cc'd). > Ok, I've encountered the problem repeatedly while building databases/tdb: it uses Python in the build process (but maybe it needs something else in parallel to provoke the problem).