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 121694

Summary: deadlock when resolve data sources
Product: javaee Reporter: liujiaguang <liujiaguang>
Component: CodeAssignee: John Baker <jbaker>
Status: VERIFIED FIXED    
Severity: blocker CC: alexpetrov, blaha, phejl, romanmostyka
Priority: P2 Keywords: THREAD
Version: 6.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Attachments: the messages log file of 6.0rc1
deadlock_when_ResolveDataSources_1.png
deadlock_when_ResolveDataSources_2.png
deadlock_when_ResolveDataSources_3.png
deadlock_when_ResolveDataSources_4.png
thread dump

Description liujiaguang 2007-11-12 05:22:30 UTC
System Info: 
  Product Version         = NetBeans IDE 6.0 RC1 (Build 200711111200)
  Operating System        = Windows 2000 version 5.0 running on x86
  Java; VM; Vendor        = 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05; Sun Microsystems Inc.
  Java Home               = D:\jdk1.6.0_03\jre
  System Locale; Encoding = zh_CN (nb); GBK
  Home Directory          = C:\Documents and Settings\Administrator
  Current Directory       = D:\NetBeans6.0RC1

1. Run NetBeans IDE 6.0 rc1(or 6.0beta2)
2. Open a existing web project which using a data source(with oracle jdbc driver v9.2 in tomcat v6.0.14), a warning
dialoag box show: "One or more projects use database connection that have not been registered. Right-click the project
in the projects window and choose Relolve Data Source Problem to help register database connections."
3. Right-click the project in the projects window and choose "Relolve Data Source Problem...", and then click the button
"Add connection..." in the dialog box with title "Resolve Data Sources".
4. In the dialog box "New DataBase Connection", click "New Driver..." at the list menu of "Name". Add the (Oracle jdbc)
driver file "E:\fcas\web\WEB-INF\lib\ojdbc14.jar". and then click "OK"
5. Now, just a few seconds later, the IDE is deadlock. You can't do anything, except killing the IDE's process in Windoz
Task Manager.
6. After kill the IDE, and then rerun it, the data source problem is disappear, it has been resolved.

Chinese:
系统信息:
  产品版本:NetBeans IDE 6.0 RC1 (Build 200711111200)
  操作系统:Windows 2000 version 5.0 running on x86
  Java虚拟机; 供应商:1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05; Sun Microsystems Inc.
  JDK安装目录:D:\jdk1.6.0_03\jre
  系统地区与编码:zh_CN (nb); GBK
  用户目录:C:\Documents and Settings\Administrator
  IDE安装目录:D:\NetBeans6.0RC1

1. 启动NetBeans IDE 6.0 rc1(或6.0beta2)
2. 打开一个已经存在的使用了数据源(data source)的web项目(该项目在Tomcat 6.0.14中使用了Oracle 9.2的JDBC驱动程序),会弹出
一个警告窗口,内容为:
“一个或多个项目使用了未注册的数据库连接。在项目窗口的项目节点点击鼠标右键,并选择解决数据源问题,以帮助解决数据库连接。”
3. 在项目窗口的项目节点点击鼠标右键,并选择“解决数据源问题...”,再在标题为“解决数据源”的对话框中点击“添加连接...”按钮," 
4. 在“新的数据库连接”对话框中,在名称的下拉菜单里点选“新的驱动...”,添加(Oracle的JDBC)驱动程序文件“E:\fcas\web\WEB-INF
\lib\ojdbc14.jar”。并点击“确定”。
5. 现在,仅几秒之后,整个IDE死锁了,你什么都做不了,只能在Windoz的任务管理中杀死IDE的进程。
6. 杀死IDE后,再次运行它,此时数据源问题消失了,它已经被解决完了。
Comment 1 liujiaguang 2007-11-12 05:25:36 UTC
Created attachment 52857 [details]
the messages log file of 6.0rc1
Comment 2 liujiaguang 2007-11-12 05:33:23 UTC
Created attachment 52858 [details]
deadlock_when_ResolveDataSources_1.png
Comment 3 liujiaguang 2007-11-12 05:33:42 UTC
Created attachment 52859 [details]
deadlock_when_ResolveDataSources_2.png
Comment 4 liujiaguang 2007-11-12 05:34:00 UTC
Created attachment 52860 [details]
deadlock_when_ResolveDataSources_3.png
Comment 5 liujiaguang 2007-11-12 05:34:17 UTC
Created attachment 52861 [details]
deadlock_when_ResolveDataSources_4.png
Comment 6 Petr Hejl 2007-11-12 09:36:28 UTC
Looks like the problem is in the db api. Can you provide thread dump (To generate a stack trace on Windows 95, or
Windows NT platforms, enter the key sequence <ctrl><break> in the window where the Java program is running, or click the
Close button on the window.)?
Comment 7 Petr Hejl 2007-11-12 11:45:32 UTC
When exactly the deadlock occurs. When click ok in add driver dialog or when you click ok in new connection dialog?
Comment 8 liujiaguang 2007-11-12 12:16:41 UTC
The dialog box "New JDBC Driver" is good, I can click "OK" button in it(deadlock_when_ResolveDataSources_3.png).

Then dialog box "New JDBC Driver" is closed correctly, and the focus return on the dialog box "New Database 
Connection"(deadlock_when_ResolveDataSources_4.png).

In the dialog box "New Database Connection", the three buttons(OK/Cancel/Help) can't handle any key event and can't 
handle any mouse click event. The deadlock occurs! 

The same say, I can't close the dialog box "New Database Connection" after set a new driver, and I can't use the IDE 
anymore.
Comment 9 Petr Hejl 2007-11-13 14:05:05 UTC
Can you provide the thread dump mentioned in desc7?
Comment 10 Jiri Prox 2007-11-22 17:58:49 UTC
*** Issue 122315 has been marked as a duplicate of this issue. ***
Comment 11 Petr Hejl 2007-11-23 11:34:07 UTC
Seems to be related to resolving missing oracle connection.
Comment 12 Petr Hejl 2007-11-23 11:52:36 UTC
p2 according to priority guideline
Comment 13 David Vancouvering 2007-11-26 19:51:20 UTC
Hi, John.  I know this is in the DB area, but it appears to be closely related to the work you did on resolving data
sources.  Do you want to take this?  It doesn't need to be fixed in 6.0, but it's a P2 for the 6.1.

Thanks!
Comment 14 Petr Hejl 2007-12-01 17:55:18 UTC
Get "lucky" with reproducing.

Please never use swing components outside of the event dispatch thread (as described here:
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/dispatch.html), unless it is explicitly allowed in javadoc.
There is manipulation with JButton in a helper thread causing the deadlock.

Attaching thread dump.
Comment 15 Petr Hejl 2007-12-01 17:56:34 UTC
Created attachment 53748 [details]
thread dump
Comment 16 John Baker 2007-12-02 02:32:15 UTC
I'll work on this next week

It looks like the button action handler code is run outside the EDT
Comment 17 John Baker 2007-12-04 01:46:31 UTC
the bug is the jButton is reset in a RequestProcessor thread instead of EDB.

Fix is available.  Listen for list data model changes then in EDT, if list is empty reset the button 
Comment 18 John Baker 2007-12-04 22:07:07 UTC
Fixed in the trunk

Checking in j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java,v  <-- 
MissingDatabaseConnectionWarning
new revision: 1.8; previous revision: 1.7
done
Comment 19 John Baker 2007-12-05 00:20:24 UTC
Small mistake in last integration. If data source is removed then the list should be checked if empty, not if data
source is added

Checking in j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java,v  <-- 
MissingDatabaseConnectionWarning
new revision: 1.9; previous revision: 1.8
done
Comment 20 John Baker 2007-12-06 07:55:41 UTC
will provide a better fix
Comment 21 John Baker 2007-12-10 23:05:55 UTC
improved the fix, also found a problem in the fireContentsChanged call

Checking in j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java,v  <-- 
MissingDatabaseConnectionWarning.java
new revision: 1.11; previous revision: 1.10
done
Comment 22 John Baker 2007-12-11 22:18:48 UTC
No need to use weak listener.  The listener will be GC'd when the panel closes

Checking in j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/MissingDatabaseConnectionWarning.java,v  <-- 
MissingDatabaseConnectionWarning.java
new revision: 1.12; previous revision: 1.11
done
Comment 23 John Baker 2008-01-18 17:52:44 UTC
*** Issue 125530 has been marked as a duplicate of this issue. ***
Comment 24 Petr Blaha 2008-01-21 07:50:04 UTC
Reporter, can you please verify the fix in the latest daily build? 
Comment 25 liujiaguang 2008-01-23 09:58:19 UTC
The bug has been fixed,so close this issue.

==========
Product Version: NetBeans IDE 6.0 (Build 200711261600)
Test result: deadlock

Product Version: NetBeans IDE 6.1 Dev (Build 200801030000)
Test result: work fine

Product Version: NetBeans IDE 6.1 Dev (Build 200801220000)
Test result: work fine

Product Version: NetBeans IDE 6.0.1 ml Dev (Build 200801190000 Simplified Chinese)
Test result: deadlock

Product Version: NetBeans IDE 6.0.1 ml Dev (Build 200801061200 Simplified Chinese)
Test result: deadlock

==========
Chinese:

缺陷已修正,因此关闭此事件。

产品版本:NetBeans IDE 6.0 (Build 200711261600)
测试结果:死锁

产品版本:NetBeans IDE 6.1 Dev (Build 200801030000)
测试结果:工作正常

产品版本:NetBeans IDE 6.1 Dev (Build 200801220000)
测试结果:工作正常

产品版本:NetBeans IDE 6.0.1 ml Dev (Build 200801190000 简体中文版)
测试结果:死锁

产品版本:NetBeans IDE 6.0.1 ml Dev (Build 200801061200 简体中文版)
测试结果:死锁
Comment 26 _ krystyna 2008-01-28 20:39:16 UTC
The reporter has tested the fix on 6.1 dev trunk (1/3 and 1/22/08)
therefore marking verified so fix can be merged into next 6.0.1 patch candidate
Comment 27 Petr Blaha 2008-01-28 21:22:51 UTC
Mark the bug as verified
Comment 28 John Baker 2008-01-29 01:28:53 UTC
Shouldn't be reopened just to mark verified.  
Comment 29 _ krystyna 2008-01-29 01:56:24 UTC
Reporter has verified.
Comment 30 pgebauer 2008-02-08 20:42:16 UTC
The fix has been ported into the release601_fixes branch.

Checking in MissingDatabaseConnectionWarning.java;
/cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/ui/Attic/MissingDatabaseConnectionWarning.java,v  <-- 
MissingDatabaseConnectionWarning.java
new revision: 1.7.8.1; previous revision: 1.7
done