changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Referencing not existing files in path in the same as wroFilter mapped to causes threads spawning and locking in when disableCache=true #482

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have wro filter mapped to /assets/*

But also have /assets/stylesheets/application.css file existing in some 
contexts and not existing on some others.

Having:

  ignoreMissingResources=true

I just always include application.css as:

  <group name="login">
    <css>/gui-v1/loginStyles.css</css>

    <group-ref>application</group-ref>
  </group>

  <group name="application">
    <css>/assets/stylesheets/application.css</css>
  </group>

and reference in jsp with /assets/login.css

But after accessing page once I'm starting to get spawning threads which gets 
locked.

This probably regressioned after issue #424.

Debug log (repeating each approx each 5 seconds) and spawning new locked 
request thread:

-----------------------------------------
ms     %     Task name
-----------------------------------------
00057  100%  createModel

01:52:04,993 DEBUG PreProcessorExecutor:79 - process and merge resources: 
[ro.isdc.wro.model.resource.Resource@5bcc5d5a[CSS,/assets/stylesheets/applicatio
n.css,true]]
01:52:04,993 DEBUG PreProcessorExecutor:85 -    merging resource: 
ro.isdc.wro.model.resource.Resource@5bcc5d5a[CSS,/assets/stylesheets/application
.css,true]
01:52:04,993 DEBUG AbstractConfigurableMultipleStrategy:73 - configured 
aliases: cssUrlRewriting,cssImport,semicolonAppender
01:52:04,994 DEBUG AbstractConfigurableMultipleStrategy:61 - using strategies: 
[ro.isdc.wro.model.resource.processor.impl.css.CssUrlRewritingProcessor@782e439a
, ro.isdc.wro.model.resource.processor.impl.css.CssImportPreProcessor@2558711a, 
ro.isdc.wro.model.resource.processor.impl.js.SemicolonAppenderPreProcessor@51697
51d]
01:52:04,994 DEBUG PreProcessorExecutor:169 - applying preProcessors: 
[ro.isdc.wro.model.resource.processor.impl.css.CssUrlRewritingProcessor@782e439a
, ro.isdc.wro.model.resource.processor.impl.css.CssImportPreProcessor@2558711a]
01:52:04,995 DEBUG ServletContextUriLocator:130 - locate resource: 
/assets/stylesheets/application.css
01:52:04,997 DEBUG DispatcherStreamLocator:65 - dispatching request to 
location: /assets/stylesheets/application.css
01:52:04,998 DEBUG RedirectedStreamServletResponseWrapper:95 - Error detected 
with code: 404 and message: /app/assets/stylesheets/application.css
01:52:05,005 DEBUG SchedulerHelper:96 - period: 0 [SECONDS]
01:52:05,006 DEBUG SchedulerHelper:96 - period: 0 [SECONDS]
01:52:05,007 DEBUG AbstractSynchronizedCacheStrategyDecorator:36 - Searching 
cache key: java.lang.String@cd32a52[application,CSS,true]
01:52:07,002 DEBUG DispatcherStreamLocator:88 - [FAIL] Error while dispatching 
the request for location /assets/stylesheets/application.css
01:52:07,003  WARN DispatcherStreamLocator:92 - Wrong or empty resource with 
location: /assets/stylesheets/application.css
01:52:07,003 DEBUG ServletContextUriLocator:192 - retrieving servletContext 
stream for uri: /assets/stylesheets/application.css
01:52:07,004 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/assets/stylesheets/application.css
01:52:07,004  WARN ServletContextUriLocator:172 - Wrong or empty resource with 
location: /assets/stylesheets/application.css
01:52:07,005  WARN PreProcessorExecutor:226 - Invalid resource found: 
ro.isdc.wro.model.resource.Resource@5bcc5d5a[CSS,/assets/stylesheets/application
.css,true]
01:52:07,006 DEBUG MinimizeAwareProcessorDecorator:61 - Using Processor: 
ro.isdc.wro.model.resource.processor.impl.css.CssUrlRewritingProcessor@782e439a
01:52:07,006 DEBUG AbstractCssUrlRewritingProcessor:128 - Applying 
CssUrlRewritingProcessor processor
01:52:07,006 DEBUG AbstractCssUrlRewritingProcessor:131 - cssUri: 
/assets/stylesheets/application.css
01:52:07,006 DEBUG CssUrlRewritingProcessor:124 - allowed urls:[..., 
/assets/stylesheets/application.css, /gui-v2/loginStyles.css]
01:52:07,007 DEBUG MinimizeAwareProcessorDecorator:61 - Using Processor: 
ro.isdc.wro.model.resource.processor.impl.css.CssImportPreProcessor@2558711a
01:52:07,007 DEBUG CssImportPreProcessor:69 - Applying CssImportPreProcessor 
processor
01:52:07,008 DEBUG ServletContextUriLocator:130 - locate resource: 
/assets/stylesheets/application.css
01:52:07,008 DEBUG DispatcherStreamLocator:65 - dispatching request to 
location: /assets/stylesheets/application.css
01:52:07,008 DEBUG RedirectedStreamServletResponseWrapper:95 - Error detected 
with code: 404 and message: /app/assets/stylesheets/application.css
01:52:07,012 DEBUG SchedulerHelper:96 - period: 0 [SECONDS]
01:52:07,012 DEBUG SchedulerHelper:96 - period: 0 [SECONDS]
01:52:07,013 DEBUG AbstractSynchronizedCacheStrategyDecorator:36 - Searching 
cache key: java.lang.String@cd32a52[application,CSS,true]
01:52:09,010 DEBUG DispatcherStreamLocator:88 - [FAIL] Error while dispatching 
the request for location /assets/stylesheets/application.css
01:52:09,010  WARN DispatcherStreamLocator:92 - Wrong or empty resource with 
location: /assets/stylesheets/application.css
01:52:09,011 DEBUG ServletContextUriLocator:192 - retrieving servletContext 
stream for uri: /assets/stylesheets/application.css
01:52:09,011 ERROR ServletContextUriLocator:215 - [FAIL] reading resource from 
/assets/stylesheets/application.css
01:52:09,011  WARN ServletContextUriLocator:172 - Wrong or empty resource with 
location: /assets/stylesheets/application.css
01:52:09,012  WARN CssImportPreProcessor:142 - Invalid import detected: 
/assets/stylesheets/application.css
01:52:09,012 DEBUG PreProcessorExecutor:79 - process and merge resources: []
01:52:09,012 DEBUG CssImportPreProcessor:112 - importsCollector: []
01:52:09,013 DEBUG PreProcessorExecutor:195 - StopWatch '': running time 
(millis) = 2007

When running with disableCache=false everything works.
Workaround if disableCache=true is needed is to create that application.css 
file in the context which misses it (empty).

Original issue reported on code.google.com by lystoc...@gmail.com on 6 Jul 2012 at 11:13

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 7 Jul 2012 at 2:49

GoogleCodeExporter commented 9 years ago
When experiencing the problem, what is the value of the parallePreprocessing 
property?

Original comment by alex.obj...@gmail.com on 7 Jul 2012 at 3:34

GoogleCodeExporter commented 9 years ago
I've implemented a fix. Could you check if it works for you with your 
application? The fix is available in branch called issue482 (on github).

Original comment by alex.obj...@gmail.com on 8 Jul 2012 at 12:29

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 8 Jul 2012 at 2:51

GoogleCodeExporter commented 9 years ago
I'm not sure where the parallePreprocessing property is set? So it should be 
default.

Unit tests breaks for me:

-------------------------------------------------------------------------------
Test set: ro.isdc.wro.model.group.processor.TestPreProcessorExecutor
-------------------------------------------------------------------------------
Tests run: 10, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.518 sec <<< 
FAILURE!
preProcessingInParallelIsFaster(ro.isdc.wro.model.group.processor.TestPreProcess
orExecutor)  Time elapsed: 1.475 sec  <<< FAILURE!
junit.framework.AssertionFailedError: 609  > 364 + 291.2
    at junit.framework.Assert.fail(Assert.java:50)
    at junit.framework.Assert.assertTrue(Assert.java:20)
    at ro.isdc.wro.model.group.processor.TestPreProcessorExecutor.preProcessingInParallelIsFaster(TestPreProcessorExecutor.java:256)

Original comment by lystoc...@gmail.com on 9 Jul 2012 at 7:09

GoogleCodeExporter commented 9 years ago
Ignore that test for a moment. Skip the tests and let me know if you can 
reproduce your problem in branch issue482.

Original comment by alex.obj...@gmail.com on 9 Jul 2012 at 7:12

GoogleCodeExporter commented 9 years ago
There were misspelling in "parallePreprocessing" it should be 
"parallelPreprocessing", this is why I couldn't find it. Have just seen in 
properties INFO output.
So by default it is:
parallelPreprocessing=false

Tried issue482 branch and it seems fixed the issue.

One notice: on each request now I get:

10:32:16,773  WARN CssImportPreProcessor:98 - Recursive import detected: 
ro.isdc.wro.model.resource.Resource@75d129d1[CSS,/assets/stylesheets/application
.css,true]

Can this be lowered to DEBUG if it is needed?

Original comment by lystoc...@gmail.com on 9 Jul 2012 at 7:46

GoogleCodeExporter commented 9 years ago
Sure, I'll update the log level. 
Thanks for confirming the fix. 

Actually I wasn't able to reproduce the "threads spawning" issue. The problem I 
found was a StackOverflowError caused by a recursive include(). 

Original comment by alex.obj...@gmail.com on 9 Jul 2012 at 7:50

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 9 Jul 2012 at 8:18