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 74692 - [EE-6] Scanning in progress doesn't disappear
Summary: [EE-6] Scanning in progress doesn't disappear
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Krauskopf
URL: http://ui.netbeans.org/nonav/usabilit...
Keywords:
Depends on: 79173
Blocks:
  Show dependency tree
 
Reported: 2006-04-10 15:00 UTC by jrojcek
Modified: 2006-06-27 10:49 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jrojcek 2006-04-10 15:00:34 UTC
Finding	
Participant wanted to finish the session bean wizard but the "Scanning in progress..." inline error didn't 
disappear even though the scanning finished. Thus the finish button was still disabled.

Severity	
1 participant had to cancel the wizard because of this problem.

Recommendation	
This is a bug. The inline error should disappear when the scanning finishes.
Comment 1 Martin Krauskopf 2006-06-23 16:04:31 UTC
I've just tried. Saw the mentioned error message, but it really disappeared
immediatelly after scanning disappeared and Finish button was dissabled. So
probably already fixed. According to CVS annotation Andrei is probably the one
who fixed it.
Comment 2 Lukas Jungmann 2006-06-23 16:17:50 UTC
Sorry i have to reopen this, because same issue appears in new websvc/websvc
client wizards. It is not easy to reproduce (don't have exact steps) but
sometimes it happens.

workaround for this is to type something to any textfield/combo in the wizard -
then the inline error disappears
Comment 3 Martin Krauskopf 2006-06-24 08:52:10 UTC
So I suppose that the code is copy-pasted everywhere. So as soon as we find the
culprit we have to fix it on all places. I'm leaving this reassinged to me with
Andrei on CC as a reviewer so we are sure we do not miss anything. Any
information which would take RANDOM away is apprecitated. Probably some
synchronization problem....
Comment 4 Andrei Badea 2006-06-26 17:04:44 UTC
I shortly looked at the code in ClientInfo which displays the "Scanning in
progress" message and I don't see anything wrong with it. 

But on the other hand I see no synchronization in JMManager.waitScanFinished()
and JMManager.isScanInProgress(). Moreover, the condition of waitScanFinished()
is different from the condition of isScanInProgress(). What is the threading
model of these methods? I thought they are thread-safe, but the implementation
doesn't look so.

If by any chance it happens that isScanInProgress() returns true even after
waitScanFinished() has returned then indeed the "Scanning in progress" message
stays displayed. As a workaround we could do

    isWaitingForScan = false;

before firing the change event. But I'd prefer to put a 

    assert !JavaMetamodel.getManager().isScanInProgress();

there instead. 

Honzo, can you please comment?
Comment 5 Jan Becicka 2006-06-27 07:29:44 UTC
Threading model is really stupid, but should work for UI purposes.
waitScanFinished iterates through all unresolved roots and waits, till they are
resolved, while isScanInProgress just shows, whether progress bar is still open.
We don't have any synchronization intentionaly because we want to avoid
deadlocks. It is possible, that isScanInProgress shows "true" *few ms* after
waitScanFinished has ended. But I believe, that *few ms* should not cause any
problems in UI.
Comment 6 Andrei Badea 2006-06-27 09:23:32 UTC
There is no guarantee in the Java memory model that lack of synchronization
works for UI purposes. Java memory model makes no difference beetween the AWT
thread and other threads. Please see

http://www.cs.umd.edu/~pugh/java/memoryModel/

for more information, especially

http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html

There are two issues in this case:

1. The two methods are incorrectly synchronized, which can cause visibility
problems (a thread can set ProgressDisplayer.instance to null, but another one
can still read the old, non-null value).

2. Even if there was correct synchronization, it is unexpected
isScanInProgress() returns true when waitScanFinished() has finished. It can be
worked around, but it is counter-intuitive.

Filed issue 79173.
Comment 7 Martin Krauskopf 2006-06-27 10:23:47 UTC
So workarounding as described by Andrei (thanks for evaluation). We may rollback
this one once the issue 79173 is fixed.

j2ee/ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/EntityEJBWizardDescriptor.java;
new revision: 1.2.2.4.2.2; previous revision: 1.2.2.4.2.1
j2ee/ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizardDescriptor.java;
new revision: 1.2.2.2.2.1; previous revision: 1.2.2.2
websvc/core/src/org/netbeans/modules/websvc/core/client/wizard/ClientInfo.java;
new revision: 1.20.8.3.2.32; previous revision: 1.20.8.3.2.31
websvc/dev/src/org/netbeans/modules/websvc/dev/wizard/WebServiceFromWSDLPanel.java;
new revision: 1.1.2.16; previous revision: 1.1.2.15
websvc/dev/src/org/netbeans/modules/websvc/dev/wizard/WebServiceTypePanel.java;
new revision: 1.1.2.14; previous revision: 1.1.2.13
Comment 8 Jan Becicka 2006-06-27 10:25:55 UTC
1. I agree, that issue 79173 is javacore bug
2. Imlementatation of "Scanning in progress..." should not be that difficult:
waitScanFinished();
SwingUtilites.invokeLater(...removeScanningInProgress..);
3. I did not say, that lack of synchronization works for UI porposes. I said,
that I believe, that these two methods works for UI purposes. We use them in
refactoring, editor, navigator and other modules without problems. So at least
there is an easy way how to implement it correctly.
Comment 9 Martin Krauskopf 2006-06-27 10:49:16 UTC
> So at least there is an easy way how to implement it correctly.

Yes, once you are aware of the bug then it is easy ;)
The question is whether all those implemenation are really working correctly
since this bug is quite random.