From owner-freebsd-java@FreeBSD.ORG Tue Oct 14 03:28:13 2008 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9418106569A for ; Tue, 14 Oct 2008 03:28:13 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.191]) by mx1.freebsd.org (Postfix) with ESMTP id 3A86F8FC17 for ; Tue, 14 Oct 2008 03:28:12 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: by mu-out-0910.google.com with SMTP id i2so1957107mue.3 for ; Mon, 13 Oct 2008 20:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=Y1a5NKEsgT5pfGJ3WVzWFF358BYJW31PfbN15nxkwm0=; b=SPlhNvYTOtINiUrZQccWfeivEpI0DUA8Wci3fZ9UXAdUe51rSoqDH7suxuSiJl5/Yn jcigkcyl4s1e9YKCtdz3ZifMsdOZxalRFV9dzDeye5PHeA76I6FrZLpHzVucAJPL/f+1 lZAo9ZX9irAANhMUSPMkHltq5F3v98d2dl004= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=nKtlGg2Pe1D2IeTcP1W1AyqygR8E1wco1/ZO5U1wP5sBwtu8st86Ry/cg+pw9b/x16 wKhVhT1r69w+P9KsU0RbGVtY5qHBC6ZFkgqNV9Hz0tRXhOv4fPloFX7n26UGF0UnS43x CA5qy4WsgtydTLR+qA+dBY66YTn8ivdEFpGQA= Received: by 10.103.245.18 with SMTP id x18mr4119790mur.20.1223954891826; Mon, 13 Oct 2008 20:28:11 -0700 (PDT) Received: from MYTAHT.totalterror.net ([87.121.19.243]) by mx.google.com with ESMTPS id j10sm9117344mue.17.2008.10.13.20.28.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Oct 2008 20:28:09 -0700 (PDT) Message-Id: From: Nikolay Denev To: Greg Lewis In-Reply-To: <20081013204710.GA52841@misty.eyesbeyond.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Tue, 14 Oct 2008 06:28:05 +0300 References: <7F26DA41-FF97-4DBB-ADAC-F7E6707B868D@gmail.com> <82DA0FAE-EAFF-4138-9CAA-21750A21D9D6@gmail.com> <20081013204710.GA52841@misty.eyesbeyond.com> X-Mailer: Apple Mail (2.929.2) Cc: freebsd-java@freebsd.org Subject: Re: Serious problem with RMI on jdk15 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 03:28:13 -0000 On Oct 13, 2008, at 11:47 PM, Greg Lewis wrote: > On Mon, Oct 13, 2008 at 05:58:58PM +0300, Nikolay Denev wrote: >> On Oct 13, 2008, at 5:47 PM, Nikolay Denev wrote: >>> On Oct 9, 2008, at 4:35 PM, Nikolay Denev wrote: >>> >>>> Hi All, >>>> >>>> I have the following problem : when I connect to a jmxremote >>>> enabled application with jconsole the whole VM crashes with >>>> segmentation fault. >>>> >>> [...snip...] >>>> >>>> I'm running amd64 7.1-PRE from yesterday, and the jdk is >>>> jdk-1.5.0.14p8_3,1 >>>> >>>> Any help is greatly appreciated! >>>> >>>> Thanks, >>>> Nikolay Denev >>> >>> I think I've tracked down the problem. >>> The JVM crashes when one requests the TotalPhysicalMemory from the >>> OperatingSystem bean. >>> The strange thing is that Sun specifies this value as "long", but >>> how this can work on 64bit machines with many gigabytes of memory? >>> >>> What BSD patchset does is read the hw.physmem sysctl, which returns >>> unsigned long, and then cast it to jlong and probably this is where >>> the problem is. >>> I've tried disabling the sysctl and hardcoding the result and my JVM >>> does not crash anymore. >>> Jconsole still does not show anything though.... and the same test >>> program produces info when used with the diablo-jdk15... >>> >>> >>> Regards, >>> Nikolay Denev >> >> As I read this now, It's not exactly correct, longs should be 4 bytes >> on 32bit archs, and 8bytes on 64bit archs. >> So the storage type for TotalPhysicalMemory should be ok. Maybe jlong >> is not correctly adjusted to 8bytes on 64bit architectures? > > A jlong is typedef'ed as a 'long long' on both 32 and 64 bit > architectures. > How much memory does the machine have and what architecture is it? > > -- > Greg Lewis Email : glewis@eyesbeyond.com > Eyes Beyond Web : http:// > www.eyesbeyond.com > Information Technology FreeBSD : glewis@FreeBSD.org Hi, I've looked at the source and found out that myself, but it is still puzzling to me why it crashes... The machine runs 7.1-PRERELASE a few days old (maybe a week) and is an amd64 with 2G of ram. All my tcpdumps of the network communication between the jconsole and the app show that it crashes right after the request for TotalPhysicalMemory, also I've confirmed this by ktracing the process, and the thread that crashes does the sysctl() to get the hw.physmem value and immediately after the return from it, it receives a SIGSEGV. I've instrumented the patchset and especialy this function not to do the sysctl() stuff but to return a hard coded value equal to the amount of memory on my machine without any casting to jlong and now it doesn't crash, so it seems that the problem is somewhere there. From what I've read "long" and "long long" should be 64bit ints on 64bit architectures, and the casting is done only because hw.physmem sysctl is ulong? Regards, Nikolay Denev