This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246591 - Unable to cancel long running queries - IDE Hangs
Summary: Unable to cancel long running queries - IDE Hangs
Status: RESOLVED DUPLICATE of bug 249214
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0.1
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2014-08-20 19:54 UTC by bolsover
Modified: 2015-02-02 02:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Threaddump (32.92 KB, text/plain)
2014-08-20 19:54 UTC, bolsover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bolsover 2014-08-20 19:54:46 UTC
Created attachment 148800 [details]
Threaddump

If I attempt to cancel a long running query, the IDE hangs.

Threaddump attached.
Comment 1 bolsover 2014-08-20 22:17:05 UTC
OOps - I missed ths from the original bug report:

Product Version: NetBeans IDE 8.0.1 (Build 201408142300)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12

Database: Pervasive SQL
Comment 2 matthias42 2014-08-21 18:48:13 UTC
Looks like getWarnings results in a network request and this seems to take longer (no server response, network down, what ever).

The call to getWarnings is issued on the EDT, blocking the whole IDE.

While looking at this, I noticed, that without logging the call to getWarnings is useless. So to "fix" this I suggest the following change  in DatabaseConnection.java. Before getWarnings was called unconditionally - with this change it is only invoked if logging on the FINE level is enabled. The additional changes (removing LOG just unifies the handling - invoking j.u.l.LOGGER.log does the same test) :

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -103,7 +103,6 @@
 public final class DatabaseConnection implements DBConnection {
 
     private static final Logger LOGGER = Logger.getLogger(DatabaseConnection.class.getName());
-    private static final boolean LOG = LOGGER.isLoggable(Level.FINE);
 
     static final long serialVersionUID =4554639187416958735L;
 
@@ -324,10 +323,14 @@
             return false;
         }
         try {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                // getWarnings could be blocking - so only call in the debug case
+                // see bug 246591
             SQLWarning warnings = conn.getWarnings();
-            if (LOGGER.isLoggable(Level.FINE) && warnings != null) {
-                LOGGER.log(Level.FINE, "Warnings while trying vitality of connection: " + warnings);
+                if(warnings != null) {
+                    LOGGER.log(Level.FINE, "Warnings while trying vitality of connection: {0}", warnings);
             }
+            }
             return !checkClosedWithTimeout(conn);
         } catch (Exception ex) {
             if (dbconn != null) {
@@ -775,9 +778,7 @@
      */
     @Override
     public Connection createJDBCConnection() throws DDLException {
-        if (LOG) {
             LOGGER.log(Level.FINE, "createJDBCConnection()");
-        }
 
         if (drv == null || db == null || usr == null ) {
             throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N
@@ -959,9 +960,7 @@
     }
 
     public Task connectAsync() {
-        if (LOG) {
             LOGGER.log(Level.FINE, "connect()");
-        }
 
         Runnable runnable = new Runnable() {
             @Override
Comment 3 matthias42 2015-01-31 13:15:35 UTC
The problem is the same as in 249214 - the patches are in fact mostly the same.

Please check, if you can verify the fix (see comment 5 in the mentioned bug). Thank you!

*** This bug has been marked as a duplicate of bug 249214 ***
Comment 4 Quality Engineering 2015-02-02 02:44:20 UTC
Integrated into 'main-silver', will be available in build *201502020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f23f043b4a4d
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #246591:Integrate missing cleanups from #249214 - remove unecessary logging and move to java7 features