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 216992 - NetBeans hangs during groovy file editing
Summary: NetBeans hangs during groovy file editing
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7 x64
: P1 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 215108 239696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-17 00:39 UTC by Alexander Kouznetsov
Modified: 2014-08-09 05:02 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
jstack output (32.29 KB, text/plain)
2012-08-17 00:39 UTC, Alexander Kouznetsov
Details
Reproducible test case (2.07 KB, application/octet-stream)
2012-09-18 12:08 UTC, Martin Janicek
Details
Simplest test project (12.17 KB, application/gzip)
2014-07-29 13:21 UTC, Martin Janicek
Details
reproduce project (34.29 KB, application/zip)
2014-07-29 16:18 UTC, moore.amberlea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kouznetsov 2012-08-17 00:39:31 UTC
Created attachment 123219 [details]
jstack output

I'm constantly getting into NetBeans stopped responding. Attached is jstack result.

Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Windows 7 version 6.1 running on amd64; Cp1251; en_US (nb)

Groovy and Grails 
Version: 1.22.1
Comment 1 Alexander Kouznetsov 2012-08-17 00:59:18 UTC
Clearing out the cache helped to proceed.
Comment 2 Martin Janicek 2012-08-20 12:23:58 UTC
*** Bug 215108 has been marked as a duplicate of this bug. ***
Comment 3 Martin Janicek 2012-09-18 07:38:38 UTC
Mm, quite weird, it's happening only in some special cases (one of them is attached in the issue 215108)..
I'm able to reproduce this only if there is 10+ classes in one groovy file. Do you have any other reproducible test case?
Comment 4 Martin Janicek 2012-09-18 12:06:00 UTC
Downgrading to P2. It definitely has to be fixed, but I don't think it's a blocker for 7.3beta as the problem occurs only in a pretty rare cases (files with more than 10 classes - at least I wasn't able to find another reproducible test case).
Comment 5 Martin Janicek 2012-09-18 12:08:45 UTC
Created attachment 124506 [details]
Reproducible test case
Comment 6 Alexander Kouznetsov 2012-09-18 16:52:05 UTC
I have a 3rd party big project that uses griffon and groovy which I couldn't share. If there is a way to obtain more information through logs or modified modules - let's do it.

Unfortunately, it's just impossible to work on this project in NetBeans. Had to switch to IntelliJ IDEA. Nice workaround. :-)
Comment 7 Martin Janicek 2012-11-30 14:04:58 UTC
CCing Tomas. This is the issue I was talking about on Monday, could you please help me with it?
It looks that application isn't deadlocked but indexing seems to be suspended for some reason and Code completion thread is waiting for it. And when user tries to make another operation with file, the IDE stops responding because GsfDocument is already locked by code completion thread and AWT is trying to get it's lock.

The reproducible test case is:

- open attached groovy file
- create new line at the beggining of Zodiac.matches method
- type "date." and press CTRL+SPACE
- while code completion is in progress, try to backspace last char (dot)
--> IDE stops responding
Comment 8 Martin Janicek 2013-02-04 09:54:47 UTC
After offline discussion requesting a waiver for NetBeans 7.3. The problem occurs only in rare cases and doesn't impact on many users (we have only one reported for the whole release).
Comment 9 Martin Janicek 2013-02-12 16:29:20 UTC
Reassigning to Tomas for evaluation.
Comment 10 Martin Janicek 2013-08-23 09:25:49 UTC
I just tried to reproduce the problem with the latest build and it seems to be gone (the steps from comment 7 were 100% reproducible earlier). I have absolutely no idea where it had been fixed, so closing as WORKSFORME

Reporter, if you get into this problem again, please reopen the issue. Thanks!
Comment 11 csbubbles 2014-03-20 22:42:51 UTC
The issue is still there. I am using NetBeans 8 and Java 8 currently. Windows 7 x64. Looks like NetBeans completely hangs when trying to find autocomplete suggestions. The bug is critical as Groovy functionality is totally broken in fact, you cannot use NetBeans wotk with Groovy because of this.
Comment 12 Martin Janicek 2014-07-16 14:46:44 UTC
*** Bug 239696 has been marked as a duplicate of this bug. ***
Comment 13 Martin Janicek 2014-07-29 13:17:28 UTC
JavaIndexerWorker.getCompileTupleIterator() seems to be using different approaches for getting completion results (in case of more than ten files it run separate tasks using CompletionService, otherwise it use sequential approach and one task for those few files).

I don't understand details but from what I can see Java is passing exactly one CompileTuple per file. On the other hand Groovy is passing one CompileTuple per declared class. Because of that, if we create a single groovy file with ten or more inner classes, JavaIndexerWorker.getCompileTupleIterator() consider it as multiple files and run separate task for each one of them. But all of them needs to access the same file causing deadlock? Just guessing the last part.

Not sure if the current JavaIndexerWorker implementation should be improved somehow or if it's more like a problem of Groovy which is passing more than one CompileTuple per file. Tomasi, what do you think??

Going to attach simplest reproducible test project.
Comment 14 Martin Janicek 2014-07-29 13:21:26 UTC
Created attachment 148384 [details]
Simplest test project
Comment 15 moore.amberlea 2014-07-29 16:18:00 UTC
Created attachment 148388 [details]
reproduce project

I too have the same issue.  I uploaded a project to reproduce this issue.  Thanks, Amber.
Comment 16 moore.amberlea 2014-08-01 17:40:55 UTC
Temporary work around:
Go to Tools - Options - Editor - [Code Completion] 
Use the options to turn off auto Code Completion.  

Note: invoking Code Completion via Ctrl+Space will still cause NetBeans to freeze, but you can at least progress until the defect is fixed.
Comment 17 Tomas Zezula 2014-08-05 13:33:34 UTC
>I don't understand details but from what I can see Java is passing exactly one >CompileTuple per file. On the other hand Groovy is passing one CompileTuple per >declared class. Because of that, if we create a single groovy file with ten or more >inner classes, JavaIndexerWorker.getCompileTupleIterator() consider it as multiple >files and run separate task for each one of them. But all of them needs to access the >same file causing deadlock?
No, the physical groovy file is not accessed by the CompileWorker in JavaIndexWorker.
The groovy file is first translated using VirtualSourceProvider into 10 virtual JavaFileObjects (java stubs for groovy file) and these JavaFileObjects are passed to JavaIndexWorker however the content is already in memory.
Comment 18 Tomas Zezula 2014-08-05 14:12:21 UTC
OK, the problem is that the prefetch is suspended by the code completion.
Comment 19 Tomas Zezula 2014-08-06 14:13:01 UTC
fixed jet-main 7b76d61e1094
Comment 20 Martin Janicek 2014-08-06 14:18:33 UTC
Thanks a lot Tome !
Comment 21 Tomas Zezula 2014-08-06 19:30:28 UTC
Fixed unit tests:
http://hg.netbeans.org/jet-main/rev/469084c6ecb0
Comment 22 Tomas Zezula 2014-08-06 20:49:48 UTC
Transplanted into NB 8.0.1: ff3f2727a8b5, cbc8ff188136
Comment 23 Quality Engineering 2014-08-07 14:47:07 UTC
Integrated into 'releases/release801', will be available in build *201408071314* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/ff3f2727a8b5
User: Tomas Zezula <tzezula@netbeans.org>
Log: #216992:NetBeans hangs during groovy file editing
Comment 24 Quality Engineering 2014-08-09 05:02:25 UTC
Integrated into 'main-silver', will be available in build *201408090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7b76d61e1094
User: Tomas Zezula <tzezula@netbeans.org>
Log: #216992:NetBeans hangs during groovy file editing