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.
dev build from sources snapshot from Feb 22. JDK 5.0u1, Linux. I have a testuserdir with j2ee project containing ejb & web modules and some other modules. The editor has an open file with EJB bussines method and some node under ejb module is probably selected in project expolorer. There is a deadlock on startup. Folder instance, RP and maybe AWT thread are involved.
Created attachment 20467 [details] thread dump
Created attachment 20468 [details] packaged testuserdir and apps
BTW: Petr N. has some observations about this. You might want to discuss it with him.
Out Mutex has no policy to avoid starvation and that is exactly what happened in this case: -) Thread A has a readAccess and waits for somebody else* -) Thread B wants writeAccess so it is queued -) Thread C then asks for readAccess, but because B is already waiting, it is queued as well. -) Thread A is starved because it waits for thread C *) This alone is not nice. Waiting for somebody while holding a precious lock. On one hand, if the Mutex was smart enough, it could grant the read request as the write requestor still sleeps. On the other hand, that could cause number of different starvation situations as any writer could be left sleeping at the end of the queue while readers keep lending the mutex to each other.
The common approach to solving deadlocks is the split the locks into hierarchy and allow only acquiring locks just in predefined order. This shall be considered in the fix of this problem as well. In NetBeans the lowest system is filesystem, then there are datasystems and later there are nodes. It should not happen that work required on datasystem level needs to wait for something to be done in nodes. That is why I think j2ee guys should change the org.netbeans.modules.j2ee.ddloaders.multiview.EjbJarMultiViewDataObject.parse(EjbJarMultiViewDataObject.java:457) org.netbeans.modules.j2ee.ddloaders.multiview.EjbJarMultiViewDataObject.createModelFromFileObject(EjbJarMultiViewDataObject.java:417) org.netbeans.modules.xml.multiview.XmlMultiViewDataObject.<init>(XmlMultiViewDataObject.java:62) org.netbeans.modules.j2ee.ddloaders.multiview.EjbJarMultiViewDataObject.<init>(EjbJarMultiViewDataObject.java:97) org.netbeans.modules.j2ee.ddloaders.ejb.EjbJarDataLoader.createMultiObject(EjbJarDataLoader.java:94) org.openide.loaders.MultiFileLoader.handleFindDataObject(MultiFileLoader.java:73) code to not create any node. The rule is do not do any (unnecessary) work in data object's constructor.
I will look at the issue. I think I'll be able to fix that.
Fixed partially for DDDataObject: http://web.netbeans.org/source/browse/web/core/src/org/netbeans/modules/web/dd/DDDataObject.java.diff?r1=1.74&r2=1.75 http://web.netbeans.org/source/browse/web/core/src/org/netbeans/modules/web/dd/DDDataNode.java.diff?r1=1.16&r2=1.17 Pavle, please something similar also for EjbMultiviewDataObject.
Fixed j2ee dd editor part http://web.netbeans.org/source/browse/j2ee/ddloaders/src/org/netbeans/modules/j2ee/ddloaders/multiview/EjbJarMultiViewDataObject.java.diff?r1=1.32&r2=1.33
*** Issue 54876 has been marked as a duplicate of this issue. ***
v.