Announcement Announcement Module
Collapse
No announcement yet.
DWR/OpenSessionInView ConnectionPool leak? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DWR/OpenSessionInView ConnectionPool leak?

    I'm using DWR 2.0.5 with Spring 2.5.

    Recently updated dwr (from a 1.0 version) because I introduced a dwr bean that required session scope. I switched our DWR configuration over to the "new style" using <dwr:controller>.

    Everything is happy except that one of the DWR beans (which did work previously) now produces dbcp exhausted errors. We are using the OpenSessionInViewFilter pattern with singleSession set to false. (setting singleSession to true fixes this problem but introduces numerous other problems application-wide).

    Here's some relevant configuration info:
    (from app-servlet.xml - which contains the dispatcherServlet configuration

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- Application context definition for "centraladmin" DispatcherServlet.
    -->
    
    <beans (board won't let me post a url, but the namespaces have not caused a problem)>
           
           
           
    
        ...
    	<bean id="urlMapping"
    		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="interceptors">
    			<list>
    				<ref local="openSessionInViewInterceptor" />
    				...
    			</list>
    		</property>
    		<property name="mappings">
                <props>
    		...
           <prop key="/dwr/**/*.*">dwrController</prop> 
           <prop key="/dwr/**/*">dwrController</prop>  
        </props>
      </property>
      <property name="alwaysUseFullPath" value="true"/>
      </bean>
    
    <!-- AJAX/DWR CONFIG AND BEANS -->	
     	<dwr:controller id="dwrController" debug="true"/>
    
    	<dwr:configuration>
      	 <dwr:convert type="bean" class="com.ourPackage.model.System">
    	    <dwr:include method="name"/>
    	    <dwr:include method="id"/>
    	 </dwr:convert>
    	 
    	 <dwr:convert type="bean" class="com.ourPackage.model.CAUser">
    	    <dwr:exclude method="authorities"/>
    	 </dwr:convert>
    	
    	<dwr:convert type="bean" class="com.ourPackage.model.*">	</dwr:convert>
    	
    	</dwr:configuration>
    	
    
    	
    	<bean id="ajaxReportDataService" class="com.ourPackage.service.ajax.AjaxReportDataServiceImpl">
        	<dwr:remote javascript="AjaxReportDataService"/>
    
            <property name="pullSystemDataAdr">
                <ref bean="pullSystemDataAdr" />
            </property>
    
    	</bean>
    	
    
    ...
    
    	<!--
    		========================= INTERCEPTORS
    		================================
    	-->
    	<bean id="openSessionInViewInterceptor"
    		class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
    		<property name="singleSession">
    			<value>false</value>
    		</property>
    	</bean>
    	
    
    </beans>

    and, from the "spring-beans.xml file

    Code:
     <bean id="baseTransactionProxy"
      class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
      abstract="true">
      <property name="transactionManager">
       <ref bean="transactionManager" />
      </property>
      <property name="transactionAttributes">
       <props>
        <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
        <prop key="*">PROPAGATION_REQUIRED,-OurSpecialException</prop>
       </props>
      </property>
     </bean>
    ...
        <!-- PullSystemDataAdr -->
        <bean id="pullSystemDataAdr" class="com.ourPackage.action.PullSystemDataAdr">
            <property name="systemDAO">
                <ref local="systemDAO" />
            </property>
            <property name="markerService">
                <ref local="markerService" />
            </property>
            <property name="systemDataAdrService">
                <ref local="systemDataAdrService" />
            </property>
            <property name="maxRecordsPerResponse">
                <value>
                    ${ra.soap.getadr.maxrecs}
                </value>
            </property>
        </bean>
    ...
    I understand that the OSIV filter is holding a connection open each time a db call is made and that this is the origin of the problem. I have some theories as to what I need to do about this, but nothing seems to be working out properly. I've tried moving the definition of the ajax bean out to the spring-beans instead of within the dispatcher servlet, but then the dwr controller does not seem to be able to see the bean. I've tried wrapping both the ajax bean and the referred to bean (pullSystemDataAdr) in transactions using baseTransactionProxy but that seems to interfere with DwrController being able to find them as well (I get errors about the beans not existing).

    I'm a little baffled as to what direction to take from here, anyone have any pointers?

  • #2
    Does anybody has similar problem ? I use DWR 2.0.6 and have pool leak too.

    Comment

    Working...
    X