Monday, November 17, 2008

How to set your server process spinning

For one of my presentations I searched for some time for a way to make my own server process get into a spinning and hung state. I found the best example in this SQL, which spins on and can be run by any user, including non-privileged. When I had a friend run it as a non-privileged user on a windows server, it made the server almost unusable, and necessitated stoping the Oracle service to get things back to normal.

SQL> select 1 from dual where regexp_like(' ','^*[ ]*a');

The statement will not return, and you may not be able to ^C out of it. The server process/thread will consume all idle CPU and the time will be spent in uninstrumented code (STATUS=WAITED SHORT TIME and SECONDS_IN_WAIT > 1).

Don't run this on any system that you can be fired for bringing down! You have been warned.


Alex Gorbachev said...

Couldn't wait to see how a RAC node will behave with 42 parallel processes running this... ;)

Kevin Closson said...

Is it spinning, or hung?

Rajat Sharma said...

Oracle Database 11g Enterprise Edition Release - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select 1 from dual where regexp_like(' ','^*[ ]*a');

no rows selected

Rajat Sharma said...

so probably not working in 11.2.0

Blogger said...

BlueHost is ultimately one of the best website hosting company for any hosting services you might need.