openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MiƂosz Tylenda <mtyle...@o2.pl>
Subject Re: Hang-ups with -javaagent
Date Fri, 19 Jun 2009 11:26:20 GMT
Hi!

Some more info. I gave it a try with the following JDK/JREs:
- Sun 5
- Sun 6
- IBM 5
- IBM 6

Only with IBM 6 I was not able to reproduce the hang-up. All other JVMs hang with the same
pattern. The Finalizer thread blocks in Class.forName - the requested class is different for
each JVM but always come from sun.* package. The main thread also blocks in Class.forName
- the requested class varies across runs, usually (always?) it is an OpenJPA class.

The hang-up vanishes if I add Class.forName statements to load the mentioned sun.* classes
in setUp() of the test case.

Greetings,
Milosz


> Rick,
> 
> Setting openjpa.DynamicEnhancementAgent to false did not have any effect.
> 
> I have figured out that the issue depends on the database connected. I can reproduce
it with MySQL and PostgreSQL but not with DB2. Even with the first two databases the reproducibility
is "not always". Below I have included suspended thread dumps from Eclipse (Windows) - the
first one is from PostgreSQL, the other one is from MySQL. As you can see, this seems to be
related to executing finalize() on driver's Connection implementations. If I can read that
stuff correctly, a hang-up occurs in TemporaryClassLoader, line 59, in Class.forName:
> 
>         // bug #283. defer to system if the name is a protected name.
>         // "sun." is required for JDK 1.4, which has an access check for
>         // sun.reflect.GeneratedSerializationConstructorAccessor1
>         if (name.startsWith("java.") || name.startsWith("javax.")
>             || name.startsWith("sun."))
>             return Class.forName(name, resolve, getClass().getClassLoader());
> 
> The name variable has a value of "sun.net.ConnectionResetException". The hang-up vanishes
when I remove "|| name.startsWith("sun.")". Does someone understand what's going on?
> 
> Regards,
> Milosz
> 
> PGSQL:
> 
> 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:1950
> (Suspended)	
> 	System Thread [Finalizer] (Suspended)	
> 		Class.forName0(String, boolean, ClassLoader) line: not available
> [native method]	
> 		Class.forName(String, boolean, ClassLoader) line: not available	
> 		TemporaryClassLoader.loadClass(String, boolean) line: 59	
> 		TemporaryClassLoader.loadClass(String) line: 44	
> 		TemporaryClassLoader(ClassLoader).loadClassInternal(String) line: not
> available	
> 		Class.forName0(String, boolean, ClassLoader) line: not available
> [native method]	
> 		Class.forName(String, boolean, ClassLoader) line: not available	
> 		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 186	
> 		PCClassFileTransformer.transform0(String, Class, byte[]) line: 132	
> 		PCClassFileTransformer.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: 120	
> 		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
> byte[]) line: not available	
> 		InstrumentationImpl.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: not available	
> 		SocketOutputStream.socketWrite(byte[], int, int) line: not available	
> 		SocketOutputStream.write(byte[], int, int) line: not available	
> 		BufferedOutputStream.flushBuffer() line: not available	
> 		BufferedOutputStream.flush() line: not available	
> 		PGStream.flush() line: 508	
> 		ProtocolConnectionImpl.close() line: 138	
> 		Jdbc3Connection(AbstractJdbc2Connection).close() line: 516	
> 		Jdbc3Connection(AbstractJdbc2Connection).finalize() line: 834	
> 		Finalizer.invokeFinalizeMethod(Object) line: not available [native
> method]	
> 		Finalizer.runFinalizer() line: not available	
> 		Finalizer.access$100(Finalizer) line: not available	
> 		Finalizer$FinalizerThread.run() line: not available	
> 	System Thread [Reference Handler] (Suspended)	
> 	Thread [main] (Suspended)	
> 		ClassLoader.findBootstrapClass(String) line: not available [native
> method]	
> 		Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String) line: not
> available	
> 		Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not
> available	
> 		Launcher$AppClassLoader.loadClass(String, boolean) line: not available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not
> available	
> 		Class.forName0(String, boolean, ClassLoader) line: not available
> [native method]	
> 		Class.forName(String, boolean, ClassLoader) line: not available	
> 		Package.getPackageInfo() line: not available	
> 		Package.getDeclaredAnnotations() line: not available	
> 		AnnotationPersistenceMetaDataParser.parsePackageAnnotations() line: 451	
> 		AnnotationPersistenceMetaDataParser.parse(Class) line: 415	
> 		PersistenceMetaDataFactory.load(Class, int, ClassLoader) line: 231	
> 		MetaDataRepository.getMetaDataInternal(Class, ClassLoader) line: 489	
> 		MetaDataRepository.getMetaData(Class, ClassLoader, boolean) line: 309	
> 		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 188	
> 		PCClassFileTransformer.transform0(String, Class, byte[]) line: 132	
> 		PCClassFileTransformer.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: 120	
> 		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
> byte[]) line: not available	
> 		InstrumentationImpl.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: not available	
> 		ClassLoader.defineClass1(String, byte[], int, int, ProtectionDomain,
> String) line: not available [native method]	
> 		Launcher$AppClassLoader(ClassLoader).defineClass(String, byte[], int, int,
> ProtectionDomain) line: not available	
> 		Launcher$AppClassLoader(SecureClassLoader).defineClass(String, byte[],
> int, int, CodeSource) line: not available	
> 		Launcher$AppClassLoader(URLClassLoader).defineClass(String, Resource)
> line: not available	
> 		URLClassLoader.access$100(URLClassLoader, String, Resource) line: not
> available	
> 		URLClassLoader$1.run() line: not available	
> 		AccessController.doPrivileged(PrivilegedExceptionAction,
> AccessControlContext) line: not available [native method]	
> 		Launcher$AppClassLoader(URLClassLoader).findClass(String) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not
> available	
> 		Launcher$AppClassLoader.loadClass(String, boolean) line: not available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not
> available	
> 		JDBCBrokerFactory.newStoreManager() line: 106	
> 		JDBCBrokerFactory(AbstractBrokerFactory).initializeBroker(boolean, int,
> BrokerImpl, boolean) line: 224	
> 		JDBCBrokerFactory(AbstractBrokerFactory).newBroker(String, String,
> boolean, int, boolean) line: 205	
> 		DelegatingBrokerFactory.newBroker(String, String, boolean, int, boolean)
> line: 160	
> 		EntityManagerFactoryImpl.createEntityManager(Map) line: 212	
> 		EntityManagerFactoryImpl.createEntityManager() line: 165	
> 		TestBasicAnnotation.testEagerFetchType() line: 44	
> 		NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
> available [native method]	
> 		NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available	
> 		DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not
> available	
> 		Method.invoke(Object, Object...) line: not available	
> 		TestBasicAnnotation(TestCase).runTest() line: 154	
> 		TestBasicAnnotation(TestCase).runBare() line: 127	
> 		TestBasicAnnotation(PersistenceTestCase).runBare() line: 466	
> 		TestResult$1.protect() line: 106	
> 		TestResult.runProtected(Test, Protectable) line: 124	
> 		TestResult.run(TestCase) line: 109	
> 		TestBasicAnnotation(TestCase).run(TestResult) line: 118	
> 		TestBasicAnnotation(PersistenceTestCase).run(TestResult) line: 181	
> 		TestSuite.runTest(Test, TestResult) line: 208	
> 		TestSuite.run(TestResult) line: 203	
> 		JUnit3TestReference.run(TestExecution) line: 128	
> 		TestExecution.run(ITestReference[]) line: 38	
> 		RemoteTestRunner.runTests(String[], String, TestExecution) line: 460	
> 		RemoteTestRunner.runTests(TestExecution) line: 673	
> 		RemoteTestRunner.run() line: 386	
> 		RemoteTestRunner.main(String[]) line: 196	
> 	System Thread [Signal Dispatcher] (Suspended)	
> 	Thread [ReaderThread] (Suspended)	
> 
> 
> MySQL:
> 
> 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:2016
> (Suspended)	
> 	System Thread [Finalizer] (Suspended)	
> 		Class.forName0(String, boolean, ClassLoader) line: not available
> [native method]	
> 		Class.forName(String, boolean, ClassLoader) line: not available	
> 		TemporaryClassLoader.loadClass(String, boolean) line: 59	
> 		TemporaryClassLoader.loadClass(String) line: 44	
> 		TemporaryClassLoader(ClassLoader).loadClassInternal(String) line: not
> available	
> 		Class.forName0(String, boolean, ClassLoader) line: not available
> [native method]	
> 		Class.forName(String, boolean, ClassLoader) line: not available	
> 		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 186	
> 		PCClassFileTransformer.transform0(String, Class, byte[]) line: 132	
> 		PCClassFileTransformer.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: 120	
> 		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
> byte[]) line: not available	
> 		InstrumentationImpl.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[]) line: not available	
> 		SocketOutputStream.socketWrite(byte[], int, int) line: not available	
> 		SocketOutputStream.write(byte[], int, int) line: not available	
> 		BufferedOutputStream.flushBuffer() line: not available	
> 		BufferedOutputStream.flush() line: not available	
> 		MysqlIO.send(Buffer, int) line: 3251	
> 		MysqlIO.quit() line: 1659	
> 		ConnectionImpl.realClose(boolean, boolean, boolean, Throwable) line:
> 4296	
> 		ConnectionImpl.cleanup(Throwable) line: 1265	
> 		ConnectionImpl.finalize() line: 2667	
> 		Finalizer.invokeFinalizeMethod(Object) line: not available [native
> method]	
> 		Finalizer.runFinalizer() line: not available	
> 		Finalizer.access$100(Finalizer) line: not available	
> 		Finalizer$FinalizerThread.run() line: not available	
> 	System Thread [Reference Handler] (Suspended)	
> 	Thread [main] (Suspended)	
> 		ClassLoader.findBootstrapClass(String) line: not available [native
> method]	
> 		Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String) line: not
> available	
> 		Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not
> available	
> 		Launcher$AppClassLoader.loadClass(String, boolean) line: not available	
> 		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not
> available	
> 		Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not
> available	
> 		ConnectionImpl.rollback() line:
> 4628	
> 		LoggingConnectionDecorator$LoggingConnection_(DelegatingConnection).rollback() line:
> 234	
> 		LoggingConnectionDecorator$LoggingConnection_(LoggingConnectionDecorator$LoggingConnection).rollback()
line:
> 398	
> 		ConfiguringConnectionDecorator$ConfiguringConnection_(DelegatingConnection).rollback()
line:
> 234	
> 		ConfiguringConnectionDecorator$ConfiguringConnection_(ConfiguringConnectionDecorator$ConfiguringConnection).rollback()
line: 148	
> 		SchemaTool.executeSQL(String[]) line: 1196	
> 		SchemaTool.deleteTableContents() line: 427	
> 		SchemaTool.run() line: 335	
> 		MappingTool.record(MappingTool$Flags) line: 501	
> 		MappingTool.record() line: 453	
> 		JDBCBrokerFactory.synchronizeMappings(ClassLoader, JDBCConfiguration)
> line: 159	
> 		JDBCBrokerFactory.synchronizeMappings(ClassLoader) line: 163	
> 		JDBCBrokerFactory.newBrokerImpl(String, String) line: 119	
> 		JDBCBrokerFactory(AbstractBrokerFactory).newBroker(String, String,
> boolean, int, boolean) line: 204	
> 		DelegatingBrokerFactory.newBroker(String, String, boolean, int, boolean)
> line: 160	
> 		EntityManagerFactoryImpl.createEntityManager(Map) line: 212	
> 		EntityManagerFactoryImpl.createEntityManager() line: 165	
> 		TestBasicAnnotation.testEagerFetchType() line: 44	
> 		NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
> available [native method]	
> 		NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available	
> 		DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not
> available	
> 		Method.invoke(Object, Object...) line: not available	
> 		TestBasicAnnotation(TestCase).runTest() line: 154	
> 		TestBasicAnnotation(TestCase).runBare() line: 127	
> 		TestBasicAnnotation(PersistenceTestCase).runBare() line: 466	
> 		TestResult$1.protect() line: 106	
> 		TestResult.runProtected(Test, Protectable) line: 124	
> 		TestResult.run(TestCase) line: 109	
> 		TestBasicAnnotation(TestCase).run(TestResult) line: 118	
> 		TestBasicAnnotation(PersistenceTestCase).run(TestResult) line: 181	
> 		TestSuite.runTest(Test, TestResult) line: 208	
> 		TestSuite.run(TestResult) line: 203	
> 		JUnit3TestReference.run(TestExecution) line: 128	
> 		TestExecution.run(ITestReference[]) line: 38	
> 		RemoteTestRunner.runTests(String[], String, TestExecution) line: 460	
> 		RemoteTestRunner.runTests(TestExecution) line: 673	
> 		RemoteTestRunner.run() line: 386	
> 		RemoteTestRunner.main(String[]) line: 196	
> 	System Thread [Signal Dispatcher] (Suspended)	
> 	Thread [ReaderThread] (Suspended)	
> 	Thread [MySQL Statement Cancellation Timer] (Suspended)	
> 
> 
> > 
> > Milosz -
> > 
> > Setting openjpa.DynamicEnhancementAgent to false should not have any affect
> > on your scenario for two reasons. First, when you are using the javaagent
> > for enhancement the dynamic enhancer detects that and will not do any work.
> > Second, the dynamic enhancer depends on an API that exists ONLY on the Sun
> > 1.6 JDK. 
> > 
> > Let me know if you have any more debug info as I'd be interested in getting
> > to the bottom of the hang that you're observing.
> > 
> > -Rick
> > -- 
> > View this message in context: http://n2.nabble.com/Hang-ups-with--javaagent-tp3072225p3080441.html
> > Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> > 
> > 
> 

Mime
View raw message