From owner-freebsd-java@FreeBSD.ORG Thu Jun 3 09:08:55 2004 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 04EA716A4CE for ; Thu, 3 Jun 2004 09:08:55 -0700 (PDT) Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.162.213]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7481B43D46 for ; Thu, 3 Jun 2004 09:08:54 -0700 (PDT) (envelope-from daniel.fisher@vt.edu) Received: from dagger.cc.vt.edu (IDENT:mirapoint@evil-dagger [10.1.1.11]) by lennier.cc.vt.edu (8.12.8/8.12.8) with ESMTP id i53G8rNn310037 for ; Thu, 3 Jun 2004 12:08:53 -0400 (EDT) Received: from psych.iad.vt.edu (psych.iad.vt.edu [128.173.13.108]) by dagger.cc.vt.edu (MOS 3.4.6-GR) with SMTP id AXT21454; Thu, 3 Jun 2004 12:08:51 -0400 (EDT) Date: Thu, 3 Jun 2004 12:08:10 -0400 From: Daniel Fisher To: java@freebsd.org Message-Id: <20040603120810.096a1975@psych.iad.vt.edu> In-Reply-To: References: <20040601154601.0869f5b4@psych.iad.vt.edu> <40BD7C06.5050205@noc.ntua.gr> <20040602095245.48cb3c44@psych.iad.vt.edu> Organization: Virginia Tech X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i386-portbld-freebsd5.2.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: possible threading problem X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2004 16:08:55 -0000 On Wed, 02 Jun 2004 21:42:59 +0200 Ronald Klop wrote: > On Wed, 2 Jun 2004 09:52:45 -0400, Daniel Fisher > wrote: > > > On Wed, 02 Jun 2004 10:04:38 +0300 > > Panagiotis Astithas wrote: > > > >> Daniel Fisher wrote: > >> > I'm experiencing a weird threading problem with jdk-1.4.2p6_3 that I > >> don't > >> > see on Linux. > >> > It looks like the BSD JDK is not honoring sychronize statements. > >> > Has anyone seen this before? > >> > If not, who should I send sample code to? > >> > >> Um, the list? > >> -- > >> Panagiotis Astithas > > > > Alrighty then.... > > attached is a tarball with the sample classes in it. > > Untar and cd into the directory. > > Execute: java -jar prop.jar > > These classes monitor the main.properties file and echo the changes to > > stdout. > > Edit main.properties while the java job is running. > > FreeBSD JVM throws an InterruptedIOException, Linux JVM does not throw an > > exception. > > Add debugging like, so you can make sure synchronized is (not) working. > synchronized (a) { > System.out.println("In a 1"); > ... > System.out.println("Out a 1"); > } > > If I recompile your program I get other results after modifying the > properties file. > java.lang.NoClassDefFoundError: prop/PropEvent > at prop.PropSingleton.removeProperties(PropSingleton.java:74) > at prop.PropMonitor.run(PropMonitor.java:71) > at java.lang.Thread.run(Thread.java:534) > > PropMonitor interrupts itself. Why? it's useless. > By the way if you don't do this your program works. > > Offtopic: > In PropMonitor you catch Exception. So you will mis all other possible > error messages from java. > If this is not just a test class I would rewrite it. > Why this: > try { > throw Exception(); > } catch (Exception) { > break; > } > > You can also just do break in stead of the exception. > And you can remove all the interrupt/interrupted calls. Only keep the > boolean run. > And even nicer than the break is setting run = false to end the while. > > But only removing the stopMonitor call from PropMonitor.run() will also > make it work. :-) > > Ronald. > I think you've missed the point. The question is, why does the BSD JVM behave differently and does it need fixing? -- Daniel Fisher