Derby can enter infinite loop  and consume 100% cpu  when loading class when 
running a stored procedure within Eclipse 3.2
--------------------------------------------------------------------------------------------------------------------------

         Key: DERBY-1446
         URL: http://issues.apache.org/jira/browse/DERBY-1446
     Project: Derby
        Type: Bug

  Components: JDBC  
    Versions: 10.1.2.5    
 Environment:        
This problem was found on Windows XP.  I haven't tried on       
     
Linux, so I don't know if the problem appears there. 

    Reporter: Kathey Marsden


The problem occurs  with the interaction between Derby and Eclipse 
3.2   with  WTP datatools.                                     
                        
If you try to run a Derby stored  procedure using the connection that WTP 
datatools establishes,  the CallableStatement.execute() method never returns 
and the 
CPU utilization on your system goes to 100%.  Simple SQL query 
(e.g. SELECT, etc) which use java.sql.Statement can be 
successfully executed using the connection that WTP obtains.    
Geting a driver manager connection directly the problem does not occur.


Some change in eclipse 3.2 (perhaps related to the classloader context?) seems 
to trigger the issue, but in this context 1) Derby can't find the class and 2) 
It loops forever looking for it, which it shouldn't do. So I think there is a 
Derby bug here, even if it ends up there is an Eclipse/OSGI bug as well.  

Below are some details from the WTP expert  looking at this.

1) I tested WTP 1.5 with both the Sun JRE 1.4.2 and IBM JRE 1.5  and the 
problem occurs
2) I tested WTP 1.0.3 and the problem does not occur
3) I tested WTP 1.0.3 but installed it into Eclipse 3.2 and the problem occurs

Eclipse 3.2 seems to be the cause of the problem.

When the hang occurs, I paused the debugger and always got the same stack trace 
which I have attached in its entirety.  The top of the stack trace is as 
follows.  Note that the driver is interacting with the OSGI engine of Eclipse.  
It looks like a defect in the OSGI runtime.  It doesn't seem to find the jar 
holding the stored procedure and then proceeds to go into an infinite loop in 
filllnStackTrace().  I'll take this up with the Eclipse team and see what I can 
find out.

Thread [main] (Suspended)       
        Throwable.fillInStackTrace() line: not available [native method]        
        ClassNotFoundException(Throwable).<init>(String, Throwable) line: not 
available 
        ClassNotFoundException(Exception).<init>(String, Throwable) line: not 
available 
        ClassNotFoundException.<init>(String) line: not available       
        ClasspathManager.findLocalClassImpl(String, ClassLoadingStatsHook[]) 
line: 442  
        ClasspathManager.findLocalClass(String) line: 410       
        DefaultClassLoader.findLocalClass(String) line: 188     
        BundleLoader.findLocalClass(String) line: 339   
        BundleLoader.findClass(String, boolean) line: 391       
        BundleLoader.findClass(String) line: 352        
        DefaultClassLoader.loadClass(String, boolean) line: 83  
        URLClassLoader(ClassLoader).loadClass(String, boolean) line: not 
available      
        URLClassLoader(ClassLoader).loadClass(String) line: not available       
        ContextFinder.loadClass(String, boolean) line: 94       
        ContextFinder(ClassLoader).loadClass(String) line: not available        
        ReflectClassesJava2.loadClassNotInDatabaseJar(String) line: not 
available       
        ReflectClassesJava2(DatabaseClasses).loadApplicationClass(String) line: 
not available

 
REPRODUCTION INFO
The full reproduction information  with setup for eclipse and WTP has other 
components but should reproduce by isntalling Eclipse 3.2 with WTP and Derby.


>From the user:

To reproduce the problem, you have to execute a stored 
procedure from within Eclipse, using the connection that WTP 
obtains. 

I've created a  very simple plugin that adds a "RUN Stored Procedure" action to 
stored procedures in the Database Explorer view of WTP.  This 
file contains a zipped Eclipse plugin development project.  
Unzip the file and import the project into an Eclipse 
workspace.  You can then use the Eclipse debugger to run an 
Eclipse application that will have the function to run a stored 
procedure which has no parameters and returns a result set.     
               
                                                                
               
To produce the problem, after you have imported the             
       
DerbySPRunTest project into your workspace,                     
               set a breakpoint in 
derbyspruntest.actions.RunRoutineAction.runRuntine() method 
before the stmt.execute()                                       
     

Start the Eclipse debugger on an Eclipse application.           
               
Open a Database Explorer view  (Windows->Show                   
               
view->Other->Data->Database Explorer) .                         
               

Right-click on Connections and select New Connection to make a  
               
connection to a Derby database that contains a stored procedure 
which has no parameters and returns a result set.               
                     
Expand the schemas and stored procedure folder to display the 
stored procedure that you want to run.                          
                      

Right click on the stored procedure and select "Run Stored 
Procedure"          
                                                                
               
The debugger will stop and you can see that when stmt.execute() 
 is executed, it never returns and your CPU utilization is at 
100%.                
                                                                
               
If I change the RunRoutineAction to use a connection that I 
obtained directly, instead of the connection obtained by WTP,  
(see commented out code), the stmt.execute() methods works 
correctly and the output is displayed in the OutputView.  The 
DerbySPRunTest plugin contains the derby.jar only for this test 
situation.  When a connection is made via WTP, WTP dynamically 
loads the driver specified on the connection dialog.            
                                                            


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to