Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.ConnectException: Connection timed out

843838Aug 10 2005 — edited Aug 10 2005
Hai,

I am working in RedHat Linux,JSP,Servlets,Java1.4,Jakarta Tomcat 4.1.30,Apache 2,Mysql 3.23.49

When I tested my application using JMeter for 250 users. I am getting the following exception for 40 users. I am getting correct output for remaining 210 users.

Is anyone encountered this kind of problem kindly help me.

I set the connectionTimeout to 3600000( that is 1 hour) in server.xml but still I am getting this exception
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8080" minProcessors="5" maxProcessors="300"
               enableLookups="true" redirectPort="8443"
               acceptCount="100" debug="0" connectionTimeout="3600000"
               useURIValidationHack="false" disableUploadTimeout="true" />
********Exception************
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient. (HttpClient.java:306)
at sun.net.www.http.HttpClient. (HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
at org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:467)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:585)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:573)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254)
at java.lang.Thread.run(Thread.java:534)

Comments

Gaz in Oz

What is your perl version?

What is your Oracle database version?

What is your Oracle:::DBD version?

What tool did you use to come to the conclusion that "empty parameter is passed to function"?

How are you declaring the 2MB "string" that you pass to function?

Does your function have an EXCEPTION block that swallows Oracle errors?

Please create a simple, small code snippet that reproduces the problem and can be run by others to help analyse the issue...

Billy Verreynne

Likely caused by not explicitly treating the bind variable explicitly as a CLOB, in Perl.

Keep in mind that a LOB variable is actually a locator (pointer) variable.

2810868

Hi Gaz in Oz.

Thanks for replying. Much apologize for incomplete definition.

1. What is your perl version?

Will update as soon as will get information from Perl developers.

2. What is your Oracle database version?

11.2.0.4 EE.

3. What is your Oracle:::DBD version?

Will update as soon as will get information from Perl developers.

4. What tool did you use to come to the conclusion that "empty parameter is passed to function"?

As was_captured column in v$sql_bind_capture shown 'NO' for query passed from Perl we captured traffic with tcpdump and calculated size of the parameter in test function.

In case of passing value to function (through binding in Perl) it was 0 and 0 respectively.

In case of inserting value into the table (through binding in Perl) value presented in tcpdump output and correct length of the variable in test function.

5. How are you declaring the 2MB "string" that you pass to function?

In PL/SQL function it was declared as clob. In Perl variable was declared as described in https://metacpan.org/pod/DBD::Oracle#Binding-for-Updates-and-Inserts-for-CLOBs-and-BLOBs (adapted to our case)

my $in_blob = <was passed from simple Web interface>;

$SQL='insert into test_lob3@tpgtest (id,clob1,clob2, blob1,blob2) values(?,?,?,?,?)';

$sth=$dbh->prepare($SQL );

$sth->bind_param(1,3);

$sth->bind_param(2,$in_clob,{ora_type=>SQLT_CHR});

$sth->bind_param(3,$in_clob,{ora_type=>SQLT_CHR});

$sth->bind_param(4,$in_blob,{ora_type=>SQLT_BIN});

$sth->bind_param(5,$in_blob,{ora_type=>SQLT_BIN});

$sth->execute();

6. Does your function have an EXCEPTION block that swallows Oracle errors?

No at a moment. But an error was in the tcpdump. If I correctly recall it was ora-01403 no data found.

Please create a simple, small code snippet that reproduces the problem and can be run by others to help analyse the issue...

PL/SQL part:

create table tmp_tmp (

  str clob

);

create or replace function fn_HDedup_Start (

  s_Id in varchar2,

  s_Time in varchar2,

  c_Str in clob

) return integer

  authid definer

is

  pragma autonomous_transaction;

begin

  insert

    into tmp_tmp

    values (c_Str);

  return 0;

end fn_HDedup_Start;

I will upload Perl code when get it from Perl developers.

2810868

Hi Billy~Verreynne.

Thanks for replying.

Billy~Verreynne wrote:

Likely caused by not explicitly treating the bind variable explicitly as a CLOB, in Perl.

Keep in mind that a LOB variable is actually a locator (pointer) variable.

Perl developers used https://metacpan.org/pod/DBD::Oracle#Binding-for-Updates-and-Inserts-for-CLOBs-and-BLOBs to code Perl part. The disappointing thing for us is that we were able to pass clob value on insert but same technique used to pass value to the function failed.

Cookiemonster76

Not your current problem, but you'll hit it when you fix your current problem:

Autonomous transactions need to end with either commit or rollback. If they don't oracle will throw an error.

Your function has neither.

2810868

You are absolutely correct Cookiemonster76.

Original code does have commit at the end. I cut too much preparing code snippet. Sorry for confusing.

2810868

1. v5.16.3,

RHEL 7.4 (Maipo), 2.6.9-89.0.0.0.1.ELxenU

2. Instant client : 11.2.0.3.0

3.

$DBD::Oracle::VERSION = '1.74';

DBI version  $VERSION = "1.637"

5. Perl code:

foreach my $parameter (@parameter_names) {

  if ($parameter_type =~ /clob/i) {

    eval {

      $sth->bind_param(':' . $parameter, $parameters{$parameter}, {ora_type=>ORA_CLOB})

    };

  }

  elsif ($parameter_type =~ /blob/i) {

    eval {

      $sth->bind_param(':' . $parameter, $parameters{$parameter}, {ora_type=>ORA_BLOB})

    };

  }

  else {

    eval {

      $sth->bind_param(':' . $parameter, $parameters{$parameter})

    };

  }

}

If works for insert but does not work for function.

Code from the reference did not work for us for both insert and pass.

Working code:

insert into test_table values(:str_clob);

Code that does not work:

SELECT remaining_id FROM TABLE(

fn_function(:id,:time_stamp,:str_clob)

)

6. Perl snippet:

if ($max_clob_length == 0) {

    $sth = $dbh->prepare($query_configuration->{'query'})

        or return $this->_process_error('DB', $DBI::errstr);

}

else {

    $dbh->{LongReadLen} = $max_clob_length;

    $sth = $dbh->prepare($query_configuration->{'query'}, {ora_pers_lob=>1})

        or return $this->_process_error('DB', $DBI::errstr);

}

foreach my $parameter (@parameter_names) {

  if ($parameters_type{$parameter} =~ /^clob$/i) {

    eval {                                                                      

        $sth->bind_param(':' . $parameter, $parameters{$parameter}, {ora_type=>ORA_CLOB})

    };

  }

  elsif ($parameters_type{$parameter} =~ /^blob$/i) {

    eval {

        $sth->bind_param(':' . $parameter, $parameters{$parameter}, {ora_type=>ORA_BLOB})

    };

  }

  else {

      eval {

          $sth->bind_param(':' . $parameter, $parameters{$parameter})

     };

  }

  return $this->_process_error($@) if $@;

}

unless ($sth->execute()) {

    my $errstr = $DBI::errstr;

    $dbh->rollback;

    return $this->_process_error('DB', $errstr);

}

Cookiemonster76

The problem is probably in the perl side, and quite probably in the code you omitted.

Simplify things and build up.

Can you get a function with a single varchar2 parameter to work?

If you can try a single clob parameter (so no other parameters)

then add the other parameters.

2810868

It works as expected when we are passing varchar from Perl side (it was clob in Oracle side). But in this case the limit is 4000 symbols only that is not enough for us.

We simplified code on both sides just to call function on Perl side and print length of the variable passed on the Oracle side. Unfortunately that did not work.

Cookiemonster76

So post a full set of perl code that works, a full set of perl code that doesn't work and the error message.

You're giving us lots of code snippets that don't add up to a complete picture.

2810868

Finally it was a time of the source code. According with Perl developer's investigation looks clob could be passed only for insert/update statements. For function it is expected to have begin : p := f(:clob) end construction.

1 - 11
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 7 2005
Added on Aug 10 2005
3 comments
2,575 views