Oracle JDBC Connection Card dead Connection Reset

Source: Internet
Author: User
Tags generator connection reset

Keng

This is definitely the first big hole I've had since I hit the computer!

Symptoms:

Telnet to the Linux host, execute a simple Oracle JDBC Connector (jar package), the result of the abruptly card in the connection establishment verification phase, and then wait a few minutes after the connection time-out, the connection is the remote Oracle server Reset, So he called connection Reset exception.

Reason:

Reference: http://www.usn-it.de/index.php/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/

As mentioned in the reference material, Oracle JDBC requires some random data to encrypt the session token when establishing a connection, and this random data source defaults to/dev/random, and if not, it is a slow-going source of madness. Linux has a kernel entropy pool (feeling too loaded B), by collecting keyboard, mouse, interrupt, disk operation to generate random data, you can view the current entropy value by the following command:

Cat/proc/sys/kernel/random/entropy_avail

Because the host of the execution program does not have a graphical interface just through remote SSH connection, then the entropy source is less than two, if the machine is more idle then there are less than two sources, the result is to wait half a day to not a random number, you can use the command to experience a bit, with/dev/random to suppress a random number is how difficult

DD If=/dev/random of=rnd_file Bs=1 count=64

If the luck is executed quickly, you can try to use the accumulated entropy a few times, you can see the current number of entropy by the method described above

Linux also has a random number generator,/dev/urandom, as its name describes, not so random random generator, is pseudo-random, of course, will be much faster. In the Resources section, the method for modifying random sources to/dev/urandom is to add command-line arguments to the Java program:

-djava.security.egd=file:///dev/urandom

But it doesn't seem to work. So, by hand, increase the entropy, and you can execute the command.

For i in {1..100000};d o cat/proc/sys/kernel/random/entropy_avail;done;

is to repeatedly print the current entropy value 100,000 times, of course, according to the results of their own test when the entropy reaches 240+, you can press CTRL + C to terminate this command, at this time to execute the Oracle JDBC program, you can connect successfully (insurance can be a bit of entropy when the value of the end of the command). While not a practical solution, at least the problem is identified. For this matter, people are going to crash.

Oracle JDBC Connection Card dead Connection Reset

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.