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 223309 - IllegalArgumentException: Was not listening to "some_path"
Summary: IllegalArgumentException: Was not listening to "some_path"
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.3
Hardware: All All
: P1 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
: 221564 224250 224430 224575 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-12-05 12:44 UTC by kosmonaffft
Modified: 2013-01-28 15:27 UTC (History)
24 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 196127


Attachments
stacktrace (1.19 KB, text/plain)
2012-12-05 12:44 UTC, kosmonaffft
Details
additional logging (303.01 KB, text/plain)
2012-12-05 14:37 UTC, Milos Kleint
Details
stacktrace (1.17 KB, text/plain)
2012-12-13 17:05 UTC, aldobrucale
Details
stacktrace (1.22 KB, text/plain)
2012-12-14 06:44 UTC, mienamoo
Details
stacktrace (1.17 KB, text/plain)
2012-12-14 16:38 UTC, aldobrucale
Details
log with org.openide.filesystems.FileUtil.level=FINE (523.97 KB, application/octet-stream)
2012-12-18 13:37 UTC, Tomas Danek
Details
stacktrace (1.19 KB, text/plain)
2013-01-03 22:38 UTC, _ tboudreau
Details
stacktrace (1.20 KB, text/plain)
2013-01-08 17:50 UTC, misterm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kosmonaffft 2012-12-05 12:44:31 UTC
This bug was originally marked as duplicate of bug 216069, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 201211200002)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.5-b02, Java(TM) SE Runtime Environment, 1.7.0_09-b05
OS: Windows 8

User Comments:
ionuion: renamed maven project (project name, project artifactId and project folder)

javydreamercsw: Closing 28 Maven projects

mfriedenhagen: Switching to another group.

pekarna: Switched from current project group (JTexy) to another.

fverhoef: I was closing 2 projects. The directory mentioned in the summary had just been added and commited in svn.

sishbi: Reopening a master project

lforet: I was closing maven project

GUEST: I was closing a project.

mienamoo: I deleted some source files in one of my open projects and then switched project groups.

kosmonaFFFt: Close maven project...

rptmaestro: Opened a project group

wissenstein: Just gave command "Close required projects".

GUEST: close maven project




Stacktrace: 
java.lang.IllegalArgumentException: Was not listening to D:\PROJECTS\smartLIFE\smartLIFE-repo\src\test\resources
   at org.openide.filesystems.FileUtil.removeFileChangeListenerImpl(FileUtil.java:316)
   at org.openide.filesystems.FileUtil.removeRecursiveListener(FileUtil.java:425)
   at org.netbeans.modules.maven.cos.CopyResourcesOnSave.closed(CopyResourcesOnSave.java:111)
   at org.netbeans.modules.maven.ProjectOpenedHookImpl.projectClosed(ProjectOpenedHookImpl.java:289)
   at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectClosed(ProjectOpenedHook.java:87)
   at org.netbeans.spi.project.ui.support.UILookupMergerSupport$OpenHookImpl.projectClosed(UILookupMergerSupport.java:260)
Comment 1 kosmonaffft 2012-12-05 12:44:35 UTC
Created attachment 128890 [details]
stacktrace
Comment 2 Milos Kleint 2012-12-05 14:37:47 UTC
Created attachment 128900 [details]
additional logging

additional logging for FileUtil when the problem occurs
Comment 3 Jaroslav Tulach 2012-12-06 05:30:28 UTC
There is just a call to remove listener from
C:\Users\mkleint\src\nbm-maven\nbm-shared\src\test\resources
path, but there is no call to add it. But maybe the log file is truncated. Don't you have by a chance the messages.log.1, etc.?
Comment 4 Jaroslav Tulach 2012-12-06 07:06:31 UTC
Reporters, please run with -J-Dorg.openide.filesystems.FileUtil.level=FINE and attach your logs here. It will help me analyse the issue more quickly.
Comment 5 Jaroslav Tulach 2012-12-06 07:08:19 UTC
*** Bug 221564 has been marked as a duplicate of this bug. ***
Comment 6 aldobrucale 2012-12-13 17:05:08 UTC
Created attachment 129344 [details]
stacktrace

Closing a project
Comment 7 mienamoo 2012-12-14 06:44:14 UTC
Created attachment 129356 [details]
stacktrace

Switching between project groups
Comment 8 aldobrucale 2012-12-14 16:38:14 UTC
Created attachment 129387 [details]
stacktrace

Closing maven project
Comment 9 Jaroslav Tulach 2012-12-17 13:10:41 UTC
Can one of you guys run with appropriate logging enabled and report bug with more info in your logs?

> Reporters, please run with -J-Dorg.openide.filesystems.FileUtil.level=FINE 
> and attach your logs here.
Comment 10 kosmonaffft 2012-12-17 16:03:49 UTC
Yes, but i din't see this bug again...

(In reply to comment #9)
> Can one of you guys run with appropriate logging enabled and report bug with
> more info in your logs?
> 
> > Reporters, please run with -J-Dorg.openide.filesystems.FileUtil.level=FINE 
> > and attach your logs here.
Comment 11 Tomas Danek 2012-12-18 13:37:29 UTC
Created attachment 129508 [details]
log with org.openide.filesystems.FileUtil.level=FINE

Steps to reproduce are in comment of submitted exception: http://statistics.netbeans.org/exceptions/exception.do?id=640933 Attaching log with fine logging on FS.
Comment 12 Tomas Danek 2012-12-18 13:40:07 UTC
Report has 72 dups and counting -> deserves P2.
Comment 13 lhochet 2012-12-18 15:52:18 UTC
http://statistics.netbeans.org/analytics/exception.do?id=640985 has -J-Dorg.openide.filesystems.FileUtil.level=FINE enabled log
Comment 14 Jaroslav Tulach 2012-12-19 08:05:07 UTC
Tomáš's log is useful. When I seek for occurrence of /private/tmp/aaa/MavenCRUDSample/src/test/resources (which at the end leads to the final assert), I see duplicated effort to add the listener (does not fail! and I don't know why). And I see duplicated attempt to remove the listener (correctly asserts). The users of the API should not do duplicated registrations and removals.


$ grep /private/tmp/aaa/MavenCRUDSample/src/test/resources -C 1 fs-FINE.log | grep maven
FINE [org.openide.filesystems.FileUtil]: addFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@7b57ada3@/private/tmp/aaa/MavenCRUDSample/src/main/resources} @ /private/tmp/aaa/MavenCRUDSample/src/main/resources
FINE [org.openide.filesystems.FileUtil]: addFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@7b57ada3@/private/tmp/aaa/MavenCRUDSample/src/test/resources} @ /private/tmp/aaa/MavenCRUDSample/src/test/resources
FINE [org.openide.filesystems.FileUtil]: removeFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@7b57ada3@/private/tmp/aaa/MavenCRUDSample/src/test/resources} @ /private/tmp/aaa/MavenCRUDSample/src/test/resources
FINE [org.openide.filesystems.FileUtil]: removeFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@7b57ada3@/private/tmp/aaa/MavenCRUDSample/src/test/resources} @ /private/tmp/aaa/MavenCRUDSample/src/test/resources
java.lang.IllegalArgumentException: DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@7b57ada3@/private/tmp/aaa/MavenCRUDSample/src/test/resources} was not listening to /private/tmp/aaa/MavenCRUDSample/src/test/resources; only to []
Comment 15 Milos Kleint 2012-12-19 08:08:28 UTC
(In reply to comment #14)
> Tomáš's log is useful. When I seek for occurrence of
> /private/tmp/aaa/MavenCRUDSample/src/test/resources (which at the end leads to
> the final assert), I see duplicated effort to add the listener (does not fail!
> and I don't know why). 

maybe because the first one is src/main/resources while the other is src/test/resources? just judging from the snippet in the previous comment..
Comment 16 Milos Kleint 2012-12-19 08:23:55 UTC
http://hg.netbeans.org/core-main/rev/45c5b531e1d8
I've looked again at how the removal could happen twice. Apparently closed() was called multiple times. Which it should NOT, but jesse mentioned in some old bugs that for some unknown reasons there are  sometimes multiple instances of ProjectOpenedHook called. That's the only explanation for closed() being called multiple times. The changeset guards against it. I will file a separate issue for the duplicate content in project lookup.
Comment 17 Milos Kleint 2012-12-19 08:27:07 UTC
see issue 224012
Comment 18 Jaroslav Tulach 2012-12-19 08:29:45 UTC
Clearing resourceURIs in close is good idea. 

I was also speculating about re-entrant access http://hg.netbeans.org/ergonomics/rev/75eff78bf970, which may be problem as well, but not in this case (as the addRL was called on different folders).
Comment 19 Quality Engineering 2012-12-20 02:45:27 UTC
Integrated into 'main-golden', will be available in build *201212200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/45c5b531e1d8
User: Milos Kleint <mkleint@netbeans.org>
Log: #223309 when closed is called, we need to clear the resourcesURI set as well, not only remove the listeners..
Comment 20 Milos Kleint 2012-12-27 07:33:07 UTC
*** Bug 224250 has been marked as a duplicate of this bug. ***
Comment 21 Milos Kleint 2012-12-27 07:34:23 UTC
reopening, see issue 224250, a report from build later than the integrated one appeared
Comment 22 Milos Kleint 2012-12-27 07:36:50 UTC
reassigning back to filesystems, all possible issue I've found in the maven codebase are integrated and the problem is still appearing, please see issue 224250
Comment 23 Jaroslav Tulach 2013-01-03 13:48:06 UTC
Can one of you guys run with appropriate logging enabled and report bug with
more info in your logs?

> Reporters, please run with -J-Dorg.openide.filesystems.FileUtil.level=FINE 
> and attach your logs here.
Comment 24 Tomas Danek 2013-01-03 14:02:35 UTC
In my case I cannot reproduce with steps I used to reproduce:(

(In reply to comment #23)
> Can one of you guys run with appropriate logging enabled and report bug with
> more info in your logs?
> 
> > Reporters, please run with -J-Dorg.openide.filesystems.FileUtil.level=FINE 
> > and attach your logs here.
Comment 25 Milos Kleint 2013-01-03 14:28:22 UTC
*** Bug 224430 has been marked as a duplicate of this bug. ***
Comment 26 ehsavoie 2013-01-03 14:51:07 UTC
I think that this bug happens when I'm moving between git's branches in a cli but of course since the logger config is not kept in between upgrade I have no traces :(
activating them ...
Comment 27 ehsavoie 2013-01-03 15:01:26 UTC
Reproduced with logger activated:

http://statistics.netbeans.org/analytics/messageslog?id=644480
Comment 28 Exceptions Reporter 2013-01-03 20:20:20 UTC
This bug already has 100 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=196127
Comment 29 _ tboudreau 2013-01-03 22:38:16 UTC
Created attachment 129868 [details]
stacktrace

Has happened twice when switching between an open project group with many maven projects open, and project group "none"
Comment 30 Jaroslav Tulach 2013-01-07 08:50:17 UTC
(In reply to comment #27)
> Reproduced with logger activated:
> 
> http://statistics.netbeans.org/analytics/messageslog?id=644480

Alas, it turns out that the log is too huge (because of a lot of other debris) and the uploaded file is trunscated. To address that I have created a special (sub)logger: http://hg.netbeans.org/ergonomics/rev/b77b1524f007

Now I need new report with the above change set and following logging option turned on:

-J-Dorg.openide.filesystems.FileUtil.recursive.level=FINE

Please generate it asap, otherwise release date of 7.3 may be impacted.
Comment 31 Milos Kleint 2013-01-07 15:49:38 UTC
*** Bug 224575 has been marked as a duplicate of this bug. ***
Comment 32 Quality Engineering 2013-01-08 02:25:21 UTC
Integrated into 'main-golden', will be available in build *201301080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b77b1524f007
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #223309: Special logger for recursive listener problem. More detailed exception message
Comment 33 Tomas Danek 2013-01-08 13:38:19 UTC
here's the desired report: http://statistics.netbeans.org/analytics/exception.do?id=645929
(org.openide.filesystems.FileUtil.recursive.level=FINE)
Comment 34 misterm 2013-01-08 17:50:21 UTC
Created attachment 130012 [details]
stacktrace
Comment 35 Jaroslav Tulach 2013-01-09 08:54:45 UTC
The last log really seems to indicate that the calls to add/remove are properly ordered. Here is the list of extracted calls. The 2nd call to remove fails and I have no idea why.

FINE [org.openide.filesystems.FileUtil.recursive]: addFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@427c5ff3@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources

FINE [org.openide.filesystems.FileUtil.recursive]: addFileChangeListener DeepListener{org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FCL@3077df72@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources


FINE [org.openide.filesystems.FileUtil.recursive]: removeFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@427c5ff3@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources

FINE [org.openide.filesystems.FileUtil.recursive]: removeFileChangeListener DeepListener{org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FCL@3077df72@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources

FINE [org.openide.filesystems.FileUtil.recursive]: addFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@427c5ff3@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources

FINE [org.openide.filesystems.FileUtil.recursive]: addFileChangeListener DeepListener{org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FCL@3077df72@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources

INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources took: 69 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]

FINE [org.openide.filesystems.FileUtil.recursive]: removeFileChangeListener DeepListener{org.netbeans.modules.maven.cos.CopyResourcesOnSave@427c5ff3@/tmp/aaa/MavenCRUDSample/crudsample/src/main/resources} @ /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources
WARNING [org.netbeans.modules.project.ui.OpenProjectList]
java.lang.IllegalArgumentException: Was not listening to /tmp/aaa/MavenCRUDSample/crudsample/src/main/resources
	at org.openide.filesystems.FileUtil.removeFileChangeListenerImpl(FileUtil.java:336)
	at org.openide.filesystems.FileUtil.removeRecursiveListener(FileUtil.java:445)
	at org.netbeans.modules.maven.cos.CopyResourcesOnSave.closed(CopyResourcesOnSave.java:111)
	at org.netbeans.modules.maven.ProjectOpenedHookImpl.projectClosed(ProjectOpenedHookImpl.java:289)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectClosed(ProjectOpenedHook.java:89)
	at org.netbeans.spi.project.ui.support.UILookupMergerSupport$OpenHookImpl.projectClosed(UILookupMergerSupport.java:260)
	at org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectClosed(ProjectOpenedHook.java:89)
[catch] at org.netbeans.modules.project.ui.OpenProjectList.notifyClosed(OpenProjectList.java:1242)
	at org.netbeans.modules.project.ui.OpenProjectList.access$2500(OpenProjectList.java:137)
	at org.netbeans.modules.project.ui.OpenProjectList$10.run(OpenProjectList.java:916)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1454)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2048)
Comment 36 Jaroslav Tulach 2013-01-09 08:55:46 UTC
I refactored the code into separate class:
http://hg.netbeans.org/ergonomics/rev/c7888e349d13
Comment 37 Jaroslav Tulach 2013-01-09 12:57:19 UTC
ergonomics#0edb7c90b5c6
Comment 38 _ tboudreau 2013-01-09 17:48:33 UTC
A couple of diagnostic things to try - here is the map which is missing the key triggering the exception:

private static final Map<FileChangeListener,Map<File,Holder>> holders = new WeakHashMap<FileChangeListener,Map<File,Holder>>();

Try changing it to a regular HashMap, and then to Collections.synchronizedMap().  If either one fixes the problem, then the problem is definitely in filesystems.  If not, then it is probably the caller.
Comment 39 Quality Engineering 2013-01-10 03:34:12 UTC
Integrated into 'main-golden', will be available in build *201301100107* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c7888e349d13
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: In preparation of #223309: splitting the listener code out of FileUtil bloated class