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 244197 - Twig blocks prevent saving files / background scanning stalls
Summary: Twig blocks prevent saving files / background scanning stalls
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Twig (show other bugs)
Version: 8.0
Hardware: PC All
: P1 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
: 231579 234470 244220 244246 244262 244277 244288 244331 244334 244429 244488 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-30 12:29 UTC by elgrafico
Modified: 2017-11-21 03:48 UTC (History)
12 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project that causes endless background scanning if opend (1.43 KB, application/zip)
2014-04-30 14:47 UTC, elgrafico
Details
java tacktrace(?) from cancelling background scanning (72.63 KB, text/plain)
2014-04-30 14:49 UTC, elgrafico
Details
Patched twig.jar (423.48 KB, application/java-archive)
2014-05-01 16:28 UTC, Ondrej Brejla
Details
npss snapshot with the last dev version 201405010001 (486.47 KB, application/octet-stream)
2014-05-02 15:59 UTC, fabd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description elgrafico 2014-04-30 12:29:26 UTC
This issue occurs when using twig blocks and having the twig plugin activated (default).

# Scenario 1 - IDE freezes on save
Reproduce:
1) create new PHP project
2) add new "Twig HTML File"
3) enter the following content into twig file
{% block content %}test{% endblock %}

(or the sample from http://twig.sensiolabs.org/doc/tags/extends.html)
4) save file

-> IDE freezes


# Scenario 2 - endless background scanning, unable to save edited files
Reproduce:
1) Disable Twig Plugin (and restart IDE)
2) Do the same as in scenario 1
3) Enable Twig Plugin (and restart IDE)
-> never ending background scanning (indexer: text/x-twig>)
Comment 1 Ondrej Brejla 2014-04-30 12:33:06 UTC
Sorry, can't reproduce. File is saved and no endless BG scan. Sorry.

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 2 Ondrej Brejla 2014-04-30 12:45:48 UTC
Ou, sry...I got it.

"Editor Parsing Loop (201403101706)" daemon prio=10 tid=0x00007f65d42b0000 nid=0xd38 runnable [0x00007f65e2991000]
   java.lang.Thread.State: RUNNABLE
	at org.netbeans.modules.php.twig.editor.parsing.TwigParser.parse(TwigParser.java:179)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:605)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:245)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:727)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 3 elgrafico 2014-04-30 12:49:37 UTC
Observation: Freeze on save does not occur if Twig plugin is activated and the settings in Tools->Options->Editor->On Save for Language Twig* are set to 'None'

Both scenarios and avove tested with

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)

and

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.7.0_55; Java HotSpot(TM) 64-Bit Server VM 24.55-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_55-b13
System: Linux version 3.2.0-4-amd64 running on amd64; UTF-8; en_US (nb)

Thanks for looking into it!
Comment 4 Ondrej Brejla 2014-04-30 13:48:55 UTC
Can you test it in the dev [1] build? I'm not able to reproduce that there. Try clean install please (no imported old settings).

[1] http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 5 elgrafico 2014-04-30 14:47:32 UTC
Created attachment 147027 [details]
project that causes endless background scanning if opend

issue caused by content of newTwigTemplate.html.twig
Comment 6 elgrafico 2014-04-30 14:49:24 UTC
Created attachment 147028 [details]
java tacktrace(?) from cancelling background scanning
Comment 7 elgrafico 2014-04-30 14:55:48 UTC
Issues from both scenarios remain.

Product Version: NetBeans IDE Dev (Build 201404300001)
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)

Allthough I declined importing old settings, it seems that at least Tools->Options->Editor->On Save is shared system-wide.
I removed %APPDATA%\Roaming\NetBeans\dev an retried, no change.

If I can provide you with more logs or data, please tell me.

I have attached 
- an exported mini-project that should trigger the issue
- the java stacktrace(?) that was presented to me when I tried to cancel the scanning.
Comment 8 Ondrej Brejla 2014-05-01 15:27:28 UTC
*** Bug 244220 has been marked as a duplicate of this bug. ***
Comment 9 Ondrej Brejla 2014-05-01 16:28:34 UTC
Created attachment 147048 [details]
Patched twig.jar

Can you try to replace old twig.jar with this one? It should work. Thanks.

You can find it in "NB instal dir/php/modules"
Comment 10 elgrafico 2014-05-01 17:04:42 UTC
I replaced org-netbeans-modules-php-twig.jar as proposed, deactivated the old plugin and activated the new one -> both scenarios are working again.

Consider this fixed, crongrats!

Tested with
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.7.0_55; Java HotSpot(TM) 64-Bit Server VM 24.55-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_55-b13
System: Linux version 3.2.0-4-amd64 running on amd64; UTF-8; en_US (nb)

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb

Product Version: NetBeans IDE Dev (Build 201404300001)
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
Comment 11 pjacferreira 2014-05-01 21:12:40 UTC
Unfortunately the patched twig.jar didn't work for me.

After the I opened the symfony project, the background scanner quickly moved to 100% and stayed there (also one of the CPU cores went to 100%).

I had to close the project (in netbeans) then closed netbeans itself and kill the "orphaned" java process through htop.

I finally was able to open the file though, by deleting the the *-twig.jar from /usr/local/netbeans-8.0/php/modules.

This generates an exception in the logs, but the background scanner "completes" and I'm able to keep the project open.
Comment 12 pjacferreira 2014-05-01 21:20:57 UTC
Correction: where I said "file" in previous I meant "project".

Just to confirm, after having successfully being able to open the project (by me previous method, of remove the twig.jar).

I closed netbeans, replace the twig.jar, with the one attached here and re-opened Netbeans.

Low and behold, the scanner locked (this time at 56%) and I had to go through the kill process.
Comment 13 Ondrej Brejla 2014-05-02 06:12:42 UTC
pjacferreira: imho you did something wrong, it must work ;)

Attach a thread dump...it's probably another issue. And attach a sample project, where the problem can be reproduced. Thanks.
Comment 14 Ondrej Brejla 2014-05-02 06:27:00 UTC
Fixed in web-main #dbc9dbbf904b

Can't reproduce any of reported issues. Reporters, please try the PHP daily build (at least #502) [1] and if the problem still occurs, attach a sample project where it can be reproduced and thread dump. Thanks.

Lado, can you look at it a bit? Thanks.

[1] http://deadlock.netbeans.org/job/PHP-build/502/
Comment 15 elgrafico 2014-05-02 06:56:43 UTC
(In reply to pjacferreira from comment #12)
> I closed netbeans, replace the twig.jar, with the one attached here and
> re-opened Netbeans.

@pjacferreira:
You need to deactivate the Twig plugin via Tools->Options->Plugins, restart the IDE, activate the plugin and restart again to make NetBeans load the replaced one.
Also check the version of the plugin, the new one is 1.20.
Comment 16 pjacferreira 2014-05-02 08:18:05 UTC
(In reply to elgrafico from comment #15)
> (In reply to pjacferreira from comment #12)
> > I closed netbeans, replace the twig.jar, with the one attached here and
> > re-opened Netbeans.
> 
> @pjacferreira:
> You need to deactivate the Twig plugin via Tools->Options->Plugins, restart
> the IDE, activate the plugin and restart again to make NetBeans load the
> replaced one.
> Also check the version of the plugin, the new one is 1.20.

Okay, I think @elgrafico was correct and Netbeans was not assuming the new module.

I moved the jar back into /usr/local/..../modules/php (global install directory) and removed my local user directory (~/.netbeans).

When I restarted Netbeans, and re-opened the project the background scanner didn't lock up, and the TWIG editor/module is working.
I verified the module version number in the logs, and it now shows up as 1.20

Thank you,
This problem is also solved for Me.
Comment 17 naitsirch 2014-05-02 13:11:00 UTC
Yap, worked for me, too! Thanks for the fix.
Comment 18 Vladimir Riha 2014-05-02 13:15:43 UTC
I've tried it twice (each time I opened 2 Symfony2 projects and the attached project here), seems OK to me. I'll wait with verification for trunk Dev build.



Product Version: NetBeans IDE Dev (Build web-main-776-on-20140502)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Mac OS X version 10.9.2 running on x86_64; UTF-8; en_US (nb)
Comment 19 fabd 2014-05-02 15:59:59 UTC
Created attachment 147077 [details]
npss snapshot with the last dev version 201405010001

The dev version doesn't solve the problem, after remove user and cache dir, the scanning project task continue to stuck at 100%.
Comment 20 Ondrej Brejla 2014-05-02 16:07:56 UTC
*** Bug 244246 has been marked as a duplicate of this bug. ***
Comment 21 Quality Engineering 2014-05-03 05:02:23 UTC
Integrated into 'main-silver', will be available in build *201405030001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/dbc9dbbf904b
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #244197 - Twig blocks prevent saving files / background scanning stalls
Comment 22 Ondrej Brejla 2014-05-03 11:12:34 UTC
*** Bug 244246 has been marked as a duplicate of this bug. ***
Comment 23 Tomas Zezula 2014-05-05 06:37:39 UTC
*** Bug 244277 has been marked as a duplicate of this bug. ***
Comment 24 Tomas Zezula 2014-05-05 06:45:21 UTC
*** Bug 234470 has been marked as a duplicate of this bug. ***
Comment 25 Ondrej Brejla 2014-05-05 07:57:42 UTC
*** Bug 244288 has been marked as a duplicate of this bug. ***
Comment 26 Vladimir Riha 2014-05-05 09:09:05 UTC
Verified


Product Version: NetBeans IDE Dev (Build 201405050001)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Mac OS X version 10.9.2 running on x86_64; UTF-8; en_US (nb)
Comment 27 Ondrej Brejla 2014-05-05 11:13:16 UTC
Transplanted to release80 branch http://hg.netbeans.org/releases/rev/828b9fda2842 and spec version increased in commit http://hg.netbeans.org/releases/rev/5e72f2909ba1
Comment 28 Quality Engineering 2014-05-05 17:56:31 UTC
Integrated into 'releases/release80', will be available in build *201405051654* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/828b9fda2842
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #244197 - Twig blocks prevent saving files / background scanning stalls
Comment 29 Vladimir Riha 2014-05-06 09:08:11 UTC
Verified in patch1.1. I can no longer reproduce the scanning loop


Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1.1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 30 fecce91 2014-05-06 12:50:51 UTC
*** Bug 244331 has been marked as a duplicate of this bug. ***
Comment 31 Ondrej Brejla 2014-05-06 17:40:44 UTC
*** Bug 244334 has been marked as a duplicate of this bug. ***
Comment 32 Tomas Zezula 2014-05-07 14:56:16 UTC
*** Bug 231579 has been marked as a duplicate of this bug. ***
Comment 33 Vladimir Riha 2014-05-07 20:15:47 UTC
*** Bug 244262 has been marked as a duplicate of this bug. ***
Comment 34 Tomas Zezula 2014-05-14 13:15:01 UTC
*** Bug 244488 has been marked as a duplicate of this bug. ***
Comment 35 Tomas Hurka 2014-05-16 09:17:23 UTC
*** Bug 244429 has been marked as a duplicate of this bug. ***
Comment 36 Vladimir Riha 2015-03-09 09:47:06 UTC
*** Bug 244246 has been marked as a duplicate of this bug. ***
Comment 37 exru 2017-11-21 03:48:02 UTC
Hey, I don't use the TWIG plugin but the bug rise whatever on PHP project.