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 121354 - Freeze upon expanding Hg-controlled project node with large ignored subdir
Summary: Freeze upon expanding Hg-controlled project node with large ignored subdir
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords: PERFORMANCE, THREAD
: 123363 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-07 11:02 UTC by Jesse Glick
Modified: 2008-01-03 09:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (18.24 KB, text/plain)
2007-11-07 11:03 UTC, Jesse Glick
Details
Tarball of testcase (223.38 KB, application/octet-stream)
2007-11-29 01:33 UTC, Jesse Glick
Details
proposed patch (10.05 KB, patch)
2007-12-05 13:41 UTC, Padraig Obriain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-11-07 11:02:37 UTC
071106. I opened a Hg-controlled Ruby project with one source file (and some enormous .hgignore'd subdirs). The IDE
froze with massive disk activity.

'hg status' in the same dir returns the correct result instantaneously. If the IDE is scanning the ignored
subdirectories, it should not be.

Also the IDE should under no circumstances be doing this work - executing an external command - from the event thread.
Comment 1 Jesse Glick 2007-11-07 11:03:02 UTC
Created attachment 52647 [details]
Thread dump
Comment 2 Jesse Glick 2007-11-07 11:08:06 UTC
Finally finished several minutes later.

It seems the IDE is running

hg status -mardui --repository ... --cwd ... ...

If you omit the 'i' flag, it finishes immediately. If you omit -u but keep -i, it is still slow but output is smaller
(the ignored files are not shown).

I am using Hg 0.9.5.

I would suggest using -mardu and separately checking .hgignore if you need to know a list of ignored files in advance.
Comment 3 John Rice 2007-11-07 17:27:46 UTC
Jessie we need to get a test case for this. Can you tar this up and give us access to it. We need to see the .hgignore
as well.

Not sure what we can do at the minute. We need to get the ignored status back from mercurial so we can correctly ignore
a file, but mercurial only views things as files and so will give us back 1000's of Ignored files in your case. Then we
have to check against this ignored collection to see if the file in the dir we are looking at is ignored. 

We also use the SharabilityQuery from the IDE to check if a directory is to be ignored, but again this knows nothing of
what mercurial is ignoring as set in the .hgignore file.
Comment 4 Jesse Glick 2007-11-29 01:33:31 UTC
Created attachment 53634 [details]
Tarball of testcase
Comment 5 Jesse Glick 2007-11-29 01:34:33 UTC
Unpack tarball to disk. Run IDE w/ fresh user dir. Install Hg support. Add unpacked dir to Favorites. IDE freezes, even
though 'hg stat' in that dir reports nothing quickly.
Comment 6 Padraig Obriain 2007-11-29 09:09:17 UTC
When I run hg status or hg stat in the directory test121354 it reports the 100000 files in the build directory as not
tracked. 

This command takes about 30 seconds to run. Curiously if I run it a second time within a very short interval it takes
only about three seconds.

Is this the behavior you are seeing?

When I opened the directory test121354 in the IDE in Favourites view the IDE froze for what seemed like a minute.

The command hg status -marduicC was run and this returned 100000 Locally New files.
Comment 7 Jesse Glick 2007-11-29 22:57:02 UTC
'hg stat' on the example should produce no output; it may take a little while if disk caches are cold, I guess. I use
the inotify extension so my behavior is likely to differ a bit.

Anyway, the problem clearly is the usage of the -i flag, which is a bad idea. There's no good reason why you should need
a list of all ignored files up front. If you need to know if an entire subdirectory is ignored, you can simply check for
a pattern matching that dir in .hgignore.
Comment 8 Padraig Obriain 2007-11-30 09:02:30 UTC
I had been running 0.9.3 since I recently reinstalled Solaris.

When I installed mercurial 0.9.4 I see the behavior you describe.

I am looking first at moving the hg calls made during annotation out of the event thread.
Comment 9 Padraig Obriain 2007-12-05 13:41:57 UTC
Created attachment 53897 [details]
proposed patch
Comment 10 Padraig Obriain 2007-12-06 08:28:16 UTC
IDE:-------------------------------------------------
IDE: [12/6/07 8:15 AM] Committing started
Checking in FileStatusCache.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java,v  <-- 
FileStatusCache.java
new revision: 1.18; previous revision: 1.17
done
Checking in MercurialAnnotator.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/MercurialAnnotator.java,v  <--
 MercurialAnnotator.java
new revision: 1.16; previous revision: 1.15
done
Checking in util/HgCommand.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java,v  <-- 
HgCommand.java
new revision: 1.59; previous revision: 1.58
done
IDE: [12/6/07 8:16 AM] Committing finished
Comment 11 Padraig Obriain 2007-12-06 08:35:40 UTC
*** Issue 123363 has been marked as a duplicate of this issue. ***