Announcement Announcement Module
No announcement yet.
Hibernate + dbcp/c3p0 + rmi results in hang Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate + dbcp/c3p0 + rmi results in hang


    I have a spring-webapp using RMI webservice in combination with Hibernate and dbcp/c3p0. The problem is, when I enter the webapp through rmi a few times (5 aprox) to access database info via hibernate, the webapp hangs. Probably because it cannot access the database anymore.

    This problem only occurs when I use rmi. When I access the website using the same backend, there is no problem.

    mvc->manager->hibernateDao: This works fine
    rmi->manager->hibernateDao: Works about 5 times, then all data access is blocked

    I have tried several settings with dbcp/c3p0 (even default), but nothing seems to help.

    There is no problem when I use spring's DriverManagerDataSource. Then rmi works fine.

    I'm kind of lost here so I hope someone can help me with this problem.

  • #2
    I have located where the hang exactly occurs. Below you will find a stacktrace using c3p0. It seems that it hangs when it tries to acquire a pooled connection.

    I have debugged a bit further and it looks like the opened connections are not returned to the pool. How could this be?

    System Thread [RMI TCP Connection(29)-] (Stepping)
    	BasicResourcePool.awaitAcquire(long) line: 968
    	BasicResourcePool.checkoutResource(long) line: 208
    	C3P0PooledConnectionPool.checkoutPooledConnection() line: 260
    	PoolBackedDataSource.getConnection() line: 94
    	ComboPooledDataSource.getConnection() line: 521
    	LocalDataSourceConnectionProvider.getConnection() line: 80
    	ConnectionManager.openConnection() line: 417
    	ConnectionManager.getConnection() line: 144
    	BatchingBatcher(AbstractBatcher).prepareQueryStatement(String, boolean, ScrollMode) line: 105
    	CriteriaLoader(Loader).prepareQueryStatement(QueryParameters, boolean, SessionImplementor) line: 1561
    	CriteriaLoader(Loader).doQuery(SessionImplementor, QueryParameters, boolean) line: 661
    	CriteriaLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean) line: 224
    	CriteriaLoader(Loader).doList(SessionImplementor, QueryParameters) line: 2145
    	CriteriaLoader(Loader).listIgnoreQueryCache(SessionImplementor, QueryParameters) line: 2029
    	CriteriaLoader(Loader).list(SessionImplementor, QueryParameters, Set, Type[]) line: 2024
    	CriteriaLoader.list(SessionImplementor) line: 94
    	SessionImpl.list(CriteriaImpl) line: 1533
    	CriteriaImpl.list() line: 283
    	DeviceDao(BaseDaoHibernate<T,TID,TSearchCommand>).getBySearchCommand(TSearchCommand) line: 111
    	DeviceManagerImpl.getDeviceBySearchCommand(DeviceSearchCommand) line: 469
    	DeviceManagerImpl.identifyDeviceByUserAgent(String) line: 72
    	GeneratedMethodAccessor54.invoke(Object, Object[]) line: not available
    	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
    	Method.invoke(Object, Object...) line: 585
    	AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 335
    	ReflectiveMethodInvocation.invokeJoinpoint() line: 181
    	ReflectiveMethodInvocation.proceed() line: 148
    	RemoteInvocationTraceInterceptor.invoke(MethodInvocation) line: 68
    	ReflectiveMethodInvocation.proceed() line: 170
    	JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 176
    	$Proxy1.identifyDeviceByUserAgent(String) line: not available
    	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
    	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
    	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
    	Method.invoke(Object, Object...) line: 585
    	RemoteInvocation.invoke(Object) line: 179
    	DefaultRemoteInvocationExecutor.invoke(RemoteInvocation, Object) line: 33
    	RmiServiceExporter(RemoteInvocationBasedExporter).invoke(RemoteInvocation, Object) line: 76
    	RmiServiceExporter(RmiBasedExporter).invoke(RemoteInvocation, Object) line: 72
    	RmiInvocationWrapper.invoke(RemoteInvocation) line: 62
    	GeneratedMethodAccessor51.invoke(Object, Object[]) line: not available
    	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
    	Method.invoke(Object, Object...) line: 585
    	UnicastServerRef.dispatch(Remote, RemoteCall) line: 294
    	Transport$ line: 153
    	AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
    	TCPTransport(Transport).serviceCall(RemoteCall) line: 149
    	TCPTransport.handleMessages(Connection, boolean) line: 460
    	TCPTransport$ line: 701 line: 595
    Last edited by wengweng; Sep 29th, 2006, 06:36 AM.