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.
Build: NetBeans IDE Dev (Build 080714) VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26 OS: Windows XP, 5.1, x86 User Comments: 1. Connect to Oracle DB. 2. Disconnect after couple of minutes. Result: DatabaseException arises.
Created attachment 64554 [details] stacktrace
Often arising exception make bad impression of IDE.
Pretty sure this is related to issue 132580
*** Issue 140373 has been marked as a duplicate of this issue. ***
*** Issue 141145 has been marked as a duplicate of this issue. ***
*** Issue 140067 has been marked as a duplicate of this issue. ***
*** Issue 139902 has been marked as a duplicate of this issue. ***
*** Issue 132580 has been marked as a duplicate of this issue. ***
*** Issue 140259 has been marked as a duplicate of this issue. ***
*** Issue 140261 has been marked as a duplicate of this issue. ***
*** Issue 140265 has been marked as a duplicate of this issue. ***
*** Issue 140271 has been marked as a duplicate of this issue. ***
*** Issue 140272 has been marked as a duplicate of this issue. ***
*** Issue 140539 has been marked as a duplicate of this issue. ***
*** Issue 141739 has been marked as a duplicate of this issue. ***
*** Issue 141911 has been marked as a duplicate of this issue. ***
I can reproduce with Java DB.
I modified ConnectionNodeInfo.getChildren() to return an empty vector if the connection is closed, and that seems to have solved the problem. Revision 77618b8e27fc Please verify once you see it has been integrated into the main-golden build.
I still can reproduce this issue. And I see changes from the changeset. Now if I simply connect and then disconnect everything is fine, but if I expand mode and try to look tables and then disconnect I still get the same exception.
This issue has already 50 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=24630
Product Version: NetBeans IDE Dev (Build 200807310201) Java: 1.6.0_04; Java HotSpot(TM) Server VM 10.0-b19 System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb) Reproduced with "Oracle Thin" against Oracle 9i.
Integrated into 'main-golden', available in build *200807311401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/77618b8e27fc User: David Van Couvering <davidvc@netbeans.org> Log: #140068 - Getting "connection is no longer open" exceptions after closing a connection This was caused by the node model trying to refresh children under the connection when the connection was no longer valid.
OK, thanks. Can you please tell me how you reliably reproduce this? I can use Java DB, MySQL, Oracle or PostgreSQL as a backend database. Obviously my tests are not reliable.
I easily can reproduce this issue all the time. Here are the steps: 1. Connect to Oracle. 2. Expand connection's node. Now you see "Tables", "Views" and "Procedures" nodes. 3. Disconnect. And after this exception always arises.
OK, can easily reproduce, thanks.
OK, it looks like I got it fixed. It's due to threading issues - a thread comes in an notices we're still connectd and tries to refresh the children. But meanwhile another thread disconnects, and then when the first thread tries to get results from the DB the connection is closed. As I mentioned in the comments to the fix, the right way is to do what I did in the MySQL code - put all database access for a given connection on a thread that is fed by a request queue. That way all access to the DB is serialized and you don't run into these timing issues.
e10cf9d98fba
I fixed this behavior, but introduced an opposite behavior - when you create a connection, the sub-nodes (Table, View, Procedure) show now children. This is because the race condition now goes the other way - the sub-nodes think the database is not connected when it is and therefore don't query the database for the children. I am working on yet another approach. I am realizing the whole architecture around what a DatabaseConnection is and how it is managed in the explorer needs to be rethought. Normally in a multithreaded world you use a connection pool, but this places the requirement on users of the API to close the connection when they are done with it - this is an incompatible change. But at least within the explorer we should serialize access to the connection. I am trying a poor man's version of this - serializing the call to getChildren() - and we'll see if this gets us through the current spate of bugs.
9987e48e6e0a
Integrated into 'main-golden', available in build *200808021401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/e10cf9d98fba User: David Van Couvering <davidvc@netbeans.org> Log: #140068 - Getting "connection is no longer open" exceptions after closing a connection Another attempt. The Node.ChildFactory implementation is running three different threads twice to refresh the nodes. Due to timing issues, some of these are coming through before the disconnect completes, but then are still refreshing data when the connection is closed. So I have the children check to see if we're still connected before querying the database. The right way to fix this is to, as Andrei has suggested, move the stuff that works with the database to a separate thread that is fed by a queue and thus we synchronize all access to the database.
Verified with build 080804.
*** Issue 142418 has been marked as a duplicate of this issue. ***
*** Issue 140473 has been marked as a duplicate of this issue. ***
*** Issue 142993 has been marked as a duplicate of this issue. ***
Reopening - reproduced in NetBeans IDE 6.5 Beta (Build 200808111757) http://statistics.netbeans.org/exceptions/detail.do?id=124946
Have you tested this with the latest nightly build? I believe this error has been fixed. http://bits.netbeans.org/dev/nightly/latest Please either close (if it is fixed in the nightly build) or remove the INCOMPLETE keyword after you have tested with the nightly build. Thanks!
Still waiting to hear if anyone can reproduce with the latest nightly build. Otherwise I may close as fixed.
Still no response, so closing as fixed.
Verified.
reproduced in NB 6.7 (20090414) ... 164 duplicates ... last few reported for post 6.5 builds
I'll inspect what was wrong in recent NB6.7. Probable dupl of an another problem...
Marian, do have any steps to reproduce it? Thanks I tried it following the steps done by Roman Mostyka and it worked for me. No exception. The recent reports on http://statistics.netbeans.org/exceptions/detail.do?id=24630 speak about another problem than was the original org.netbeans.api.db.explorer.DatabaseException. It should be split on two different issues IMHO.
I am sorry Jirka, but I am not sure which step exactly caused an exception ... I was running select queries to DB.
Closed it as fixed again. The duplicates from recent build should go in http://www.netbeans.org/issues/show_bug.cgi?id=157243.