Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error on concurrent requests #38

Open
bgkittrell opened this issue Feb 20, 2012 · 2 comments
Open

Parsing error on concurrent requests #38

bgkittrell opened this issue Feb 20, 2012 · 2 comments

Comments

@bgkittrell
Copy link

First off all, thanks for CoffeeScript support, it came just in time.

I believe I found an issue. It seems that after you start a server with minimization on, if you hit a page multiple times before greenscript is done compiling, you get an exception.

I'm using Play 1.2.4 and Greenscript 1.2.8, with minimization and compression enabled. We are using #{greenscript tags in main.html to load javascript and coffeescript.

The exception is

54423 [play-thread-2] ERROR com.greenscriptool.Minimizer - error compile coffee script file
org.jcoffeescript.JCoffeeScriptCompileException: Error: too many ) on line 2
at org.jcoffeescript.JCoffeeScriptCompiler.compile(JCoffeeScriptCompiler.java:80)
at com.greenscriptool.Minimizer.compileCoffee_(Minimizer.java:487)
at com.greenscriptool.Minimizer.compileCoffee_(Minimizer.java:491)
at com.greenscriptool.Minimizer.preprocess_(Minimizer.java:805)
at com.greenscriptool.Minimizer.merge_(Minimizer.java:733)
at com.greenscriptool.Minimizer.minimize(Minimizer.java:512)
at com.greenscriptool.Minimizer.minimize_(Minimizer.java:568)
at com.greenscriptool.Minimizer.process(Minimizer.java:359)
at com.greenscriptool.RenderSession.output(RenderSession.java:141)
at com.greenscriptool.IRenderSession$output.call(Unknown Source)
at Template_1114$run_closure1.doCall(output.html:12)

The actual parse error changes everytime, and if I disable minimization the coffeescript compiles just fine. My guess is that the problem lies on this line, in ClosureCompiler#compile

42 JSSourceFile file = JSSourceFile.fromInputStream("greenscript.js", new ReaderInputStream(r));

It seems to me that if this was called multiple times, then multiple threads would have a handle on the greescript.js file, and could be streaming to it simultaneously, resulting in a corrupt file. That's just a guess.

I'd be happy to take a crack at fixing it, but wanted to run it by you guys since this is new code to me.

@bgkittrell
Copy link
Author

FYI, I don't think the closureCompiler method is the problem any more. I had my wires crossed. I'm still trying to pinpoint this, but it's definitely a problem with two concurrent minimize processes.

@greenlaw110
Copy link
Owner

Hi Ben,

Thank you for very much for reporting the bug. Your contribution will be
greatly appreciated.

Regards,
Green

On Tue, Feb 21, 2012 at 3:46 AM, Ben Kittrell <
reply@reply.github.com

wrote:

First off all, thanks for CoffeeScript support, it came just in time.

I believe I found an issue. It seems that after you start a server with
minimization on, if you hit a page multiple times before greenscript is
done compiling, you get an exception.

I'm using Play 1.2.4 and Greenscript 1.2.8, with minimization and
compression enabled. We are using #{greenscript tags in main.html to load
javascript and coffeescript.

The exception is

54423 [play-thread-2] ERROR com.greenscriptool.Minimizer - error compile
coffee script file
org.jcoffeescript.JCoffeeScriptCompileException: Error: too many ) on line
2
at
org.jcoffeescript.JCoffeeScriptCompiler.compile(JCoffeeScriptCompiler.java:80)
at com.greenscriptool.Minimizer.compileCoffee_(Minimizer.java:487)
at com.greenscriptool.Minimizer.compileCoffee_(Minimizer.java:491)
at com.greenscriptool.Minimizer.preprocess_(Minimizer.java:805)
at com.greenscriptool.Minimizer.merge_(Minimizer.java:733)
at com.greenscriptool.Minimizer.minimize(Minimizer.java:512)
at com.greenscriptool.Minimizer.minimize_(Minimizer.java:568)
at com.greenscriptool.Minimizer.process(Minimizer.java:359)
at com.greenscriptool.RenderSession.output(RenderSession.java:141)
at com.greenscriptool.IRenderSession$output.call(Unknown Source)
at Template_1114$run_closure1.doCall(output.html:12)

The actual parse error changes everytime, and if I disable minimization
the coffeescript compiles just fine. My guess is that the problem lies on
this line, in ClosureCompiler#compile

42 JSSourceFile file =
JSSourceFile.fromInputStream("greenscript.js", new ReaderInputStream(r));

It seems to me that if this was called multiple times, then multiple
threads would have a handle on the greescript.js file, and could be
streaming to it simultaneously, resulting in a corrupt file. That's just a
guess.

I'd be happy to take a crack at fixing it, but wanted to run it by you
guys since this is new code to me.


Reply to this email directly or view it on GitHub:
#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants