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.
Created attachment 127273 [details] Thread dump made with VisualVM Hanged after trying to stop running database query on Oracle database. Not instantly hanged after pressing "stop", but after some time. Stopping query was unsuccessful, it wasn't stopped. UI was not responding and not redrawing. Attaching thread dump.
Reproduced again: - Started long query on Oracle database (thin driver). - Pressed "x" after "Executing SQL statement(s)" to cancel. Not cancelled. - Right-clicked node representing connection in 'Services' tree. UI hanged.
Not reproduceable with doing the same with mysql. Tried to execute "select sleep(600);" on mysql, query started to execute. Stopping running query also had no effect (it continued running), but right-clicking anything in 'services' tab not caused UI to hang. Oracle connection URL caused hang is: jdbc:oracle:thin:@//(host)/(service). Driver oracle.jdbc.OracleDriver, from instantclient-basic-windows.x64-11.2.0.3.0.zip.
Please, did you encounter the bug with 7.2 only, or also with 7.3?
Tried in 7.3, it first hanged, but unfreezed after 50 seconds. And stopping running query works in 7.3 unlike 7.2 where it not worked even for mysql. However it hanged before stopping, i.e. when running query, right-clicking connection node in 'services' tree causes UI to hang (but unhanged after 50 seconds). So seems that unrelated to stopping running query, caused when right-clicking when query is running. Tried mysql in 7.3 too, not caused hanging.
Created attachment 127365 [details] Thread dump of the same problem from 7.3 beta (Build 201210011125)
"AWT-EventQueue-1" prio=6 tid=0x000000000d87a800 nid=0x1b60 waiting for monitor entry [0x000000000ec8d000] java.lang.Thread.State: BLOCKED (on object monitor) at oracle.jdbc.driver.PhysicalConnection.isClosed (PhysicalConnection.java:4364) - waiting to lock <0x00000000d4656488> (!!!) (a oracle.jdbc.driver.T4CConnection) at org.netbeans.modules.db.explorer.DatabaseConnection .isVitalConnection(DatabaseConnection.java:291) at org.netbeans.modules.db.explorer.action.ExecuteCommandAction.enable (ExecuteCommandAction.java:66) at org.openide.util.actions.NodeAction$DelegateAction.resultChanged (NodeAction.java:615) at org.openide.util.actions.NodeAction$DelegateAction.<init> (NodeAction.java:560) at org.openide.util.actions.NodeAction.createContextAwareInstance (NodeAction.java:357) at org.openide.util.Utilities.actionsToPopup(Utilities.java:2754) at org.openide.util.Utilities.actionsToPopup(Utilities.java:2850) at org.openide.explorer.view.TreeView.createPopup(TreeView.java:1058) [...] "SQLStatementExecution" daemon prio=2 tid=0x000000000d874800 nid=0x18d4 runnable [0x000000000c44e000] [...] at oracle.jdbc.driver.OracleStatement.execute (OracleStatement.java:1871) -locked <0x00000000d4656488> (a oracle.jdbc.driver.T4CConnection)(!!!) at oracle.jdbc.driver.OracleStatementWrapper.execute (OracleStatementWrapper.java:318) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper .executeSQLStatement(SQLExecutionHelper.java:713) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper .access$300(SQLExecutionHelper.java:81) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper$1Loader .run(SQLExecutionHelper.java:147) [...] Method DatabaseConnection.isVitalConnection needs to access locked driver. Accessing the same connection from multiple threads should be prevented, or the check for valid connection fixed. We'll investigate possible solutions. Thank you very much for your help!
Created attachment 127502 [details] Patch - timeout for Connection.isClosed() The problem is that a single (java.sql) Connection is used for running queries and for updating UI (e.g. deciding which actions are available). I think that the best solution would be implementing a connection pool, but it would need some deeper changes and API review. This change seems to be quite risky for 7.3. Simpler, more ugly, but still not ideal, is using a timeout in DatabaseConnection.isVitalConnection (the patch is attached). Another solution is informing the DatabaseConnection that its java.sql.Connection is currently in use, which would make isVitalConnection return instantly. But it also requires more changes (including API). Matthias, Jirka, please, do you have any opinions or ideas?
(In reply to comment #7) > The problem is that a single (java.sql) Connection is used for running queries > and for updating UI (e.g. deciding which actions are available). I agree with this assessment. > Simpler, more ugly, but still not ideal, is using a timeout in > DatabaseConnection.isVitalConnection (the patch is attached). This looks good. Actually following the documentation in http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#isClosed%28%29 , the implementation in the oracle driver is unnecessarily strict with regard to delegating to the underlying physical connection. This could be discussed internaly. The lock would needed only for Connection#isValid, as that method is expected to do some more checks (comparable to DatabaseConnection#test, judging from the documentation). With regard to the patch, i would move the creation of the thread pool in line 313 to a static, else the idea is a bit defeated :-) Apart from this, it looks good.
Created attachment 127621 [details] Patch - timeout for Connection.isClosed() > With regard to the patch, i would move the creation of the thread pool in line > 313 to a static, else the idea is a bit defeated :-) Thank you, attaching fixed patch (even existing static RequestProcessor can be used) [ashamed].
(In reply to comment #9) > Created attachment 127621 [details] > Patch - timeout for Connection.isClosed() > > > With regard to the patch, i would move the creation of the thread pool in line > > 313 to a static, else the idea is a bit defeated :-) > Thank you, attaching fixed patch (even existing static RequestProcessor can be > used) [ashamed]. Looks good.
http://hg.netbeans.org/core-main/rev/829141218633 Thank you very much for your help.
Integrated into 'main-golden', will be available in build *201211170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/829141218633 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #221602: Hanged when trying to stop database query on Oracle database
*** Bug 172807 has been marked as a duplicate of this bug. ***