You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Pavel Maximov <pa...@returnpath.net> on 2007/01/16 22:56:31 UTC

Oracle JDBC connections timeout

Hello everybody,

I'm not sure if the issue is related to the oracle driver or specific to
geronimo, but here is what's happening.

I have an oracle connection pool with the configuration below:

So the oracle driver version I'm using is 10.2.0.2.

I defined an error-page element in web.xml to redirect to a static error
page when HTTP error code is 500.

	<error-page>
		<error-code>500</error-code>
		<location>/apperror.html</location>
	</error-page>

The desired behavior for the application would be, in case database goes
down, to generate an exception with HTTP error code 500, which will be
caught by error page handler and the user will be redirected to a static
error page.

And it's working if you restart the app server when the connection is
already down (I'm testing installing an iptables MAC-address based
filter to reject packets, not to drop them, so it's not a TCP stack
issue).

/sbin/iptables -A INPUT -m mac --mac-source 00:0B:DB:E7:9D:1F -d 0/0 -j
REJECT --reject-with icmp-host-prohibited

However, when the app server is already running and DB connection goes
down (iptables filter is installed) - the app is hanging instead of
generating an exception within a reasonable timeout period.

Any clues how to prevent this from happening? I need an app to generate
an exception instead of hanging. Are there any hidden driver setting or
deployment plan elements to configure this?

This is happening on geronimo 1.1.1, and the app is using JDBC calls
directly, without any ORM or caching.

Thank you for any help with this,
--Pavel.

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
    <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
        <dep:moduleId>
            <dep:groupId>console.dbpool</dep:groupId>
            <dep:artifactId>DevDBPool2</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>oracle</dep:groupId>
                <dep:artifactId>oracle-thin</dep:artifactId>
                <dep:version>10.2.0.2</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
 
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-int
erface>
                <connectiondefinition-instance>
                    <name>DevDBPool2</name>
                    <config-property-setting
name="Password">xxxxxxxxx</config-property-setting>
                    <config-property-setting
name="Driver">oracle.jdbc.OracleDriver</config-property-setting>
                    <config-property-setting
name="UserName">xxxxxxxxx</config-property-setting>
                    <config-property-setting
name="ConnectionURL">jdbc:oracle:thin:@devdb.pmd:1521:SPMDDB1</config-pr
operty-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>20</max-size>
                            <min-size>0</min-size>
 
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
 
<idle-timeout-minutes>10</idle-timeout-minutes>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>

Re: Oracle JDBC connections timeout

Posted by Kevan Miller <ke...@gmail.com>.
On Jan 16, 2007, at 7:41 PM, David Jencks wrote:

> This sounds a lot like an oracle driver problem, in which case  
> there's not a lot we can do about it.
>
> I would set up a test bed that tries to get a connection to oracle  
> under the same circumstances as you have in geronimo and see if it  
> hangs forever.
>
> Can you tell exactly what is happening during the hang?  Since you  
> don't have this problem when you start geronimo when the db is down  
> I'd expect it's trying to use a preexisting connection, but  
> confirmint this might be useful.

Pavel,
It might be useful to generate a java thread dump when your app is  
hanging (windows: ctrl-break, linux: ctrl-\ or kill -QUIT  
<process_id>), but then again it might not help us at all...

--kevan


Re: Oracle JDBC connections timeout

Posted by David Jencks <da...@yahoo.com>.
This sounds a lot like an oracle driver problem, in which case  
there's not a lot we can do about it.

I would set up a test bed that tries to get a connection to oracle  
under the same circumstances as you have in geronimo and see if it  
hangs forever.

Can you tell exactly what is happening during the hang?  Since you  
don't have this problem when you start geronimo when the db is down  
I'd expect it's trying to use a preexisting connection, but  
confirmint this might be useful.

hope this helps
david jencks

On Jan 16, 2007, at 1:56 PM, Pavel Maximov wrote:

> Hello everybody,
>
> I'm not sure if the issue is related to the oracle driver or  
> specific to
> geronimo, but here is what's happening.
>
> I have an oracle connection pool with the configuration below:
>
> So the oracle driver version I'm using is 10.2.0.2.
>
> I defined an error-page element in web.xml to redirect to a static  
> error
> page when HTTP error code is 500.
>
> 	<error-page>
> 		<error-code>500</error-code>
> 		<location>/apperror.html</location>
> 	</error-page>
>
> The desired behavior for the application would be, in case database  
> goes
> down, to generate an exception with HTTP error code 500, which will be
> caught by error page handler and the user will be redirected to a  
> static
> error page.
>
> And it's working if you restart the app server when the connection is
> already down (I'm testing installing an iptables MAC-address based
> filter to reject packets, not to drop them, so it's not a TCP stack
> issue).
>
> /sbin/iptables -A INPUT -m mac --mac-source 00:0B:DB:E7:9D:1F -d  
> 0/0 -j
> REJECT --reject-with icmp-host-prohibited
>
> However, when the app server is already running and DB connection goes
> down (iptables filter is installed) - the app is hanging instead of
> generating an exception within a reasonable timeout period.
>
> Any clues how to prevent this from happening? I need an app to  
> generate
> an exception instead of hanging. Are there any hidden driver  
> setting or
> deployment plan elements to configure this?
>
> This is happening on geronimo 1.1.1, and the app is using JDBC calls
> directly, without any ORM or caching.
>
> Thank you for any help with this,
> --Pavel.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.1">
>     <dep:environment
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
>         <dep:moduleId>
>             <dep:groupId>console.dbpool</dep:groupId>
>             <dep:artifactId>DevDBPool2</dep:artifactId>
>             <dep:version>1.0</dep:version>
>             <dep:type>rar</dep:type>
>         </dep:moduleId>
>         <dep:dependencies>
>             <dep:dependency>
>                 <dep:groupId>oracle</dep:groupId>
>                 <dep:artifactId>oracle-thin</dep:artifactId>
>                 <dep:version>10.2.0.2</dep:version>
>                 <dep:type>jar</dep:type>
>             </dep:dependency>
>         </dep:dependencies>
>     </dep:environment>
>     <resourceadapter>
>         <outbound-resourceadapter>
>             <connection-definition>
>
> <connectionfactory-interface>javax.sql.DataSource</ 
> connectionfactory-int
> erface>
>                 <connectiondefinition-instance>
>                     <name>DevDBPool2</name>
>                     <config-property-setting
> name="Password">xxxxxxxxx</config-property-setting>
>                     <config-property-setting
> name="Driver">oracle.jdbc.OracleDriver</config-property-setting>
>                     <config-property-setting
> name="UserName">xxxxxxxxx</config-property-setting>
>                     <config-property-setting
> name="ConnectionURL">jdbc:oracle:thin:@devdb.pmd:1521:SPMDDB1</ 
> config-pr
> operty-setting>
>                     <connectionmanager>
>                         <local-transaction/>
>                         <single-pool>
>                             <max-size>20</max-size>
>                             <min-size>0</min-size>
>
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>
> <idle-timeout-minutes>10</idle-timeout-minutes>
>                             <match-one/>
>                         </single-pool>
>                     </connectionmanager>
>                 </connectiondefinition-instance>
>             </connection-definition>
>         </outbound-resourceadapter>
>     </resourceadapter>
> </connector>