Re: [play-2.1-10112012] Each request triggers reload

836 views
Skip to first unread message

Eric Jain

unread,
Oct 30, 2012, 7:06:42 PM10/30/12
to play-fr...@googlegroups.com
Does this problem persist after doing a `play clean-all`?


On Tuesday, October 30, 2012 3:56:22 AM UTC-7, Dirk Louwers wrote:
Hi,

I am toying around with Play 2.1 and noticed that all requests (including every single asset request) trigger a recompile on my Mac, even when nothing has changed. Interestingly a colleague used the same project on his Ubuntu machine and didn't have this issue. Hope anyone has a clue as to what could be causing this.

Best,

Dirk 

Eric Jain

unread,
Oct 31, 2012, 11:30:46 PM10/31/12
to play-fr...@googlegroups.com
On Wed, Oct 31, 2012 at 6:23 AM, Dirk Louwers
<dirk.l...@stormlantern.nl> wrote:
> I have run sbt clean and clean-files and deleted the directories that the clean command should. I guess it's worth noting that I am using Play from sbt.

`clean-all` might delete more files than `clean` or `clean-files`? In
any case, if you managed to reproduce the problem on a second machine
from a fresh checkout, this isn't likely to be the problem.

James Roper

unread,
Oct 31, 2012, 11:41:57 PM10/31/12
to play-fr...@googlegroups.com
Actually we've just started noticing a similar issue on an internal project at Typesafe, I'm about to take a deeper look into it, stay tuned.

Dirk Louwers

unread,
Nov 1, 2012, 9:33:36 AM11/1/12
to play-fr...@googlegroups.com
Ok, looking forward to your findings.


Op donderdag 1 november 2012 04:41:57 UTC+1 schreef James Roper het volgende:

James Roper

unread,
Nov 2, 2012, 1:34:29 AM11/2/12
to play-fr...@googlegroups.com
Hi Dirk,

What is the result of the reload each time?  Is it a compilation failure?  Or does it successfully reload the app?  I think the issue we were seeing was actually due to a polling script, when compilation failed, each subsequent request would trigger a recompile, but that's by design, so there's no issue there.  If that's different to your issue, then could you paste the logs of a full reload loop?

Cheers,

James

Dirk Louwers

unread,
Nov 2, 2012, 6:28:54 AM11/2/12
to play-fr...@googlegroups.com
Hi James,

There is no compilation failure. It successfully reloads the app. It just does that for every single request. I have set all log-levels to DEBUG and get the following:

2012-11-02 11:23:20,178 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.BoneCPPlugin] is disabled

2012-11-02 11:23:20,179 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.evolutions.EvolutionsPlugin] is disabled

2012-11-02 11:23:20,195 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
Application started (Dev)

2012-11-02 11:23:22,366 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.BoneCPPlugin] is disabled

2012-11-02 11:23:22,367 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.evolutions.EvolutionsPlugin] is disabled

2012-11-02 11:23:22,395 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
Application started (Dev)

2012-11-02 11:23:24,951 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.BoneCPPlugin] is disabled

2012-11-02 11:23:24,951 - [DEBUG] - from play in play-akka.actor.default-dispatcher-5 
Plugin [play.api.db.evolutions.EvolutionsPlugin] is disabled

2012-11-02 11:23:24,975 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
Application started (Dev)

etc. for each separate request

Best,

Dirk



Op vrijdag 2 november 2012 06:34:29 UTC+1 schreef James Roper het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 6:47:58 AM11/2/12
to play-fr...@googlegroups.com
Further research has shown that on every request a single specific template gets recompiled, even when it hasn't been changed. If we delete said template the website doesn't reload every time. If we re-add it the problem pops-up again. There are no outside processes changing the template file but changes are detected none the less.

Setting logging to TRACE does not expose the reason why it is constantly recompiling this template. 

Op vrijdag 2 november 2012 06:34:29 UTC+1 schreef James Roper het volgende:

Manuel Bernhardt

unread,
Nov 2, 2012, 7:43:24 AM11/2/12
to play-fr...@googlegroups.com
Hi,

Which version of OS X do you have?

Manuel
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/Tmvsl1Y4zNcJ.
>
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

Dirk Louwers

unread,
Nov 2, 2012, 7:54:49 AM11/2/12
to play-fr...@googlegroups.com
Hi,

10.7.5 and 10.6.8 both have this issue.

Best,

Dirk

Op vrijdag 2 november 2012 12:43:53 UTC+1 schreef Manuel Bernhardt het volgende:

Manuel Bernhardt

unread,
Nov 2, 2012, 8:16:55 AM11/2/12
to play-fr...@googlegroups.com
Hi Dirk,

- do you have anything special set-up in regards to your drives? Do
you perhaps use some kind of encryption?
- what are the file permissions on that template file?

Manuel
> https://groups.google.com/d/msg/play-framework/-/_nYlJtLSZTsJ.

Dirk Louwers

unread,
Nov 2, 2012, 8:27:09 AM11/2/12
to play-fr...@googlegroups.com
Hi,

Nothing special set up.
Permissions are: 

-rw-r--r--  1 dirk  staff  13958 31 okt 16:16 template.scala.html

Same as all the other templates.

Dirk

Op vrijdag 2 november 2012 13:17:29 UTC+1 schreef Manuel Bernhardt het volgende:

Guillaume Bort

unread,
Nov 2, 2012, 8:32:10 AM11/2/12
to play-fr...@googlegroups.com
Can you check if there is any special/hidden char in this file that could corrupt the HASH computation in some way? The template are recompiled if the template compiler decide that the content changed. To know that it uses a content HASH that is stored into the generated scala source file.

Check into target/scala-2.x.x/src_managed/main/views/html/....

The generated file should contain something like:

/*
    -- GENERATED --
    DATE: Fri Nov 02 10:38:00 CET 2012
    SOURCE: /private/tmp/doc-review/app/views/index.scala.html
    HASH: a9468e14516db88237e3431e8b54cf7780705202
    MATRIX: 505->1|599->18|636->21|671->48|710->50|755->61|769->67|807->84
    LINES: 19->1|22->1|24->3|24->3|24->3|26->5|26->5|26->5
    -- GENERATED --
*/ 


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/mEWsAVAlERMJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.



--
Guillaume Bort, http://guillaume.bort.fr

Dirk Louwers

unread,
Nov 2, 2012, 9:49:28 AM11/2/12
to play-fr...@googlegroups.com
The hash in the generated code does not vary. So unless it uses two different hash methods it should not detect the file as changed. Visual scan of the template shows no special characters. All characters are ASCII. The only situation I can think of where a different hash value is produced is when MessageDigest#digest is accessed asynchronously...

Op vrijdag 2 november 2012 13:32:38 UTC+1 schreef Guillaume Bort het volgende:

Guillaume Bort

unread,
Nov 2, 2012, 10:52:16 AM11/2/12
to play-fr...@googlegroups.com
Could you try to debug or add a few traces here:


There is probably something wrong with that.


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/unC8rBrK_7wJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Guillaume Bort

unread,
Nov 2, 2012, 10:54:21 AM11/2/12
to play-fr...@googlegroups.com
Well looking at the code, it could have something to do with encoding. The `byteArray` call don't specify the encoding to use. Perhaps for any reasons this encoding change during the generation and the check phases.

Gustavo Hexsel

unread,
Nov 2, 2012, 10:59:44 AM11/2/12
to play-fr...@googlegroups.com
  Can you check the case of the original and generated files?  

  I had colleagues that had similar issues with SVN clashing because the Mac filesystem was not set to be case-sensitive and some file had its name modified on the server from Somethinga to SomethingA.  Every "svn update" failed.

Dirk Louwers

unread,
Nov 2, 2012, 11:32:31 AM11/2/12
to play-fr...@googlegroups.com
The case is the same. Namely all lowercase.

Op vrijdag 2 november 2012 15:59:44 UTC+1 schreef Gustavo Hexsel het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 11:35:38 AM11/2/12
to play-fr...@googlegroups.com
Well, I am using the 2.1-10112012 sbt plugin. I don't know what version of the libraries it pulls in but it doesn't include the sources. I could clone master and try to reproduce in a unit test though.

Op vrijdag 2 november 2012 15:52:49 UTC+1 schreef Guillaume Bort het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 12:35:39 PM11/2/12
to play-fr...@googlegroups.com
After manually hashing the template using OpenSSL it appears that the HASH value written into the template is incorrect. For other templates it is fine. Looking at the differences, the template compiler writes hash value as Path(source).string while it is being compared to Path(source).byteArray.

Op vrijdag 2 november 2012 15:54:51 UTC+1 schreef Guillaume Bort het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 12:36:58 PM11/2/12
to play-fr...@googlegroups.com
After manually hashing the template using OpenSSL it appears that the HASH value written into the template is incorrect. For other templates it is fine. Looking at the differences, the template compiler writes hash value as Path(source).string while it is being compared to Path(source).byteArray.


Op vrijdag 2 november 2012 15:54:51 UTC+1 schreef Guillaume Bort het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 12:38:44 PM11/2/12
to play-fr...@googlegroups.com
After manually hashing the template using OpenSSL it appears that the HASH value written into the template is incorrect. For other templates it is fine. Looking at the differences, the template compiler writes hash value as Path(source).string while it is being compared to Path(source).byteArray.


Op vrijdag 2 november 2012 15:54:51 UTC+1 schreef Guillaume Bort het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 12:41:33 PM11/2/12
to play-fr...@googlegroups.com
After manually hashing the template using OpenSSL it appears that the HASH value written into the template is incorrect. For other templates it is fine. Looking at the differences, the template compiler writes hash value as Path(source).string while it is being compared to Path(source).byteArray.


Op vrijdag 2 november 2012 15:54:51 UTC+1 schreef Guillaume Bort het volgende:

Dirk Louwers

unread,
Nov 2, 2012, 12:43:15 PM11/2/12
to play-fr...@googlegroups.com
After manually hashing the template using OpenSSL it appears that the HASH value written into the template is incorrect. For other templates it is fine. Looking at the differences, the template compiler writes hash value as Path(source).string while it is being compared to Path(source).byteArray.


Op vrijdag 2 november 2012 15:54:51 UTC+1 schreef Guillaume Bort het volgende:

Guillaume Bort

unread,
Nov 2, 2012, 12:54:55 PM11/2/12
to play-fr...@googlegroups.com
Oh. But then I think this issue is fixed in master since a long time.


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/HPwm73NFhwcJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Dirk Louwers

unread,
Nov 2, 2012, 6:22:53 PM11/2/12
to play-fr...@googlegroups.com
Sorry for the multi-post earlier.

Ok, so what is the best way to get a snapshot of the sbt-plugin for my project? Like I stated earlier I am now using:

addSbtPlugin("play" % "sbt-plugin" % "2.1-10112012")

That is the most recent build I could find. Is there a 2.1-SNAPSHOT version of the plugin and if so on what repository?



Op vrijdag 2 november 2012 17:55:23 UTC+1 schreef Guillaume Bort het volgende:

Guillaume Bort

unread,
Nov 3, 2012, 10:55:49 AM11/3/12
to play-fr...@googlegroups.com
We will publish the 2.1-M1 in the next following days. In the meantime you can build it from source.


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/i0a1yChmonsJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Dirk Louwers

unread,
Nov 3, 2012, 1:41:08 PM11/3/12
to play-fr...@googlegroups.com
I have gotten the plugin from the snapshot repository like so:

addSbtPlugin("play" % "sbt-plugin" % "2.1-SNAPSHOT")

This exhibits the same problem. If this is indeed that latest the problem is still present.

Op zaterdag 3 november 2012 15:56:17 UTC+1 schreef Guillaume Bort het volgende:

peter hausel

unread,
Nov 3, 2012, 1:54:52 PM11/3/12
to play-fr...@googlegroups.com
I would try 2.1-11022012 instead

Dirk Louwers

unread,
Nov 3, 2012, 6:45:55 PM11/3/12
to play-fr...@googlegroups.com
Ok, tried that, still the same issue.

Op zaterdag 3 november 2012 18:54:52 UTC+1 schreef peter hausel het volgende:

James Roper

unread,
Nov 16, 2012, 3:44:50 AM11/16/12
to play-fr...@googlegroups.com
Any idea which file it's compiling?  Maybe find the file with the most recent modification date in the target directory...  What is its modification date?

On Friday, 16 November 2012 14:11:57 UTC+11, Kevin Bowling wrote:
I'm seeing a (RELOAD) loop on Linux with SNAPSHOT current as of this post's timestamp.

The first big compile after a complete clean has this:
[warn] there were 8 feature warnings; re-run with -feature for details
[warn] one warning found

Then each additional request does
[info] Compiling 1 Scala source to /home/kev009/c/xx/xx/target/scala-2.10/classes...

I use dynamic LESS compilation.  Related to recent incremental switch there?

Regards,
Kevin

Dirk Louwers

unread,
Nov 16, 2012, 4:14:11 AM11/16/12
to play-fr...@googlegroups.com
I have a template file that seems to reliably trigger this behavior that I could mail you off list if you like.

Op vrijdag 16 november 2012 09:44:50 UTC+1 schreef James Roper het volgende:

James Roper

unread,
Nov 16, 2012, 8:55:20 PM11/16/12
to play-fr...@googlegroups.com
You could send that to me at james dot roper at typesafe dot com, but I'm more interested in the modification time of the template.  Does changing the template stop it from happening?

Dirk Louwers

unread,
Nov 17, 2012, 3:59:03 PM11/17/12
to play-fr...@googlegroups.com
No it does not, it looks like there is something else causing the false hash to be stored. Seems it's more something in the line of something specific in the content but I haven't been able to isolate it so far.

2012/11/17 James Roper <jro...@gmail.com>
--
 
 

James Roper

unread,
Nov 19, 2012, 5:00:47 AM11/19/12
to play-fr...@googlegroups.com
This has now been fixed, pending merge of this pull request to master:


For anyone that is encountering this issue, the root cause is actually non UTF-8 characters in your templates.  Common culprits are ISO8859-1 curly quotes (0x91, 0x92, 0x93, 0x94), and ISO8859-1 en-dash and em-dash (0x96 and 0x97).  Play reads template files as UTF-8, so these characters are going to result in corrupted compiled templates, with strange characters appearing in the rendered page, so more important than getting this fix into Play is for you to remove/replace these characters from your templates.

Dirk Louwers

unread,
Nov 19, 2012, 9:33:30 AM11/19/12
to play-fr...@googlegroups.com
Cool. Great to hear this. 

2012/11/19 James Roper <jro...@gmail.com>
--
 
 

Dirk Louwers

unread,
Nov 19, 2012, 12:29:56 PM11/19/12
to play-fr...@googlegroups.com
Well, I have thoroughly checked and the files with the wrong hashes do indeed have non-ASCII characters, however they are UTF-8, like …, ë and é. If I remove the UTF-8 characters the problem is resolved. However, looking at the pull request this should also be fixed when it's been merged.

Op maandag 19 november 2012 11:00:47 UTC+1 schreef James Roper het volgende:

James Roper

unread,
Nov 19, 2012, 6:13:57 PM11/19/12
to play-fr...@googlegroups.com
Hmmm... I can't reproduce that.  Are you using a custom script to launch Play?  The only way I think this could be an issue is if the default platform encoding was not UTF-8, but the play script specifies -Dfile.encoding=UTF-8 when it launches SBT, so that could never be an issue.

Anyway, like you said, my fix should fix everything, since it only ever hashes the raw bytes from the files.

Dirk Louwers

unread,
Nov 20, 2012, 8:18:53 AM11/20/12
to play-fr...@googlegroups.com
Well, that must be it then. I am running directly from SBT and will likely use Mac-Roman by default on my system. I'll use the file encoding switch in my sbt launcher for now. Am I right to assume that this switch is no longer going to be necessary once this fix has been merged? 

Op dinsdag 20 november 2012 00:13:57 UTC+1 schreef James Roper het volgende:

James Roper

unread,
Nov 20, 2012, 11:03:07 PM11/20/12
to play-fr...@googlegroups.com
On Wednesday, 21 November 2012 00:18:54 UTC+11, Dirk Louwers wrote:
Well, that must be it then. I am running directly from SBT and will likely use Mac-Roman by default on my system. I'll use the file encoding switch in my sbt launcher for now. Am I right to assume that this switch is no longer going to be necessary once this fix has been merged?

Yes and no.  The bug will be fixed, so you won't get the infinite reloading.  But we don't test or run Play without this flag, and the rule in Play is that everything is UTF-8 (which is why we add the flag to the play script), so there could be other existing bugs or bugs introduced in future that will slip through our testing that you may encounter if your platform encoding is not UTF-8.

Dirk Louwers

unread,
Nov 21, 2012, 4:13:14 AM11/21/12
to play-fr...@googlegroups.com
Ok, in that case I would like to suggest to read the set encoding during startup and terminate Play with an error if the set encoding isn't UTF-8 with the advise to supply this option. No harm in doing that if it's a hard requirement anyway. Might prevent issues that are hard to debug.

2012/11/21 James Roper <jro...@gmail.com>
--
 
 

Pedro De Almeida

unread,
Jan 17, 2013, 5:01:04 AM1/17/13
to play-fr...@googlegroups.com
Hello James,

Do you know if your fix has been shipped with play-2.1-RC2? Because I am still experiencing this issue with the RC2: every time I edit a compilable file (*.scala, *.html.scala, *.less), it compiles resources and triggers an application reload on the next request without any kind of information or exception. By the way, is there a ticket for this issue somewhere?

 If helpful, here is more information about my context:
- Windows 8 x64, JDK 1.7.0_09, Play 2.1-RC2
- Running without specific parameters: play ~run
- No non-UTF characters found in compiled templates

Thanks a lot,

Pedro De Almeida

Pedro De Almeida

unread,
May 16, 2013, 6:40:17 PM5/16/13
to play-fr...@googlegroups.com
Any news? Seems that this issue still occurs with Play 2.1.1! Please, can someone update on this? Thanks.

Pedro De Almeida

francis Lavalliere

unread,
Jan 16, 2014, 10:29:42 PM1/16/14
to play-fr...@googlegroups.com
My Play  framework suddently started to reload for no reasons... only when i query a call to one of our API which uses a ProcessBuilder command (which creates files in /tmp/ )

Not sure why it reloads...

francis Lavalliere

unread,
Jan 16, 2014, 10:35:16 PM1/16/14
to play-fr...@googlegroups.com
I am actually using Play-2.2. RC1  but somehow it was working fine before... thats what I find strange..
Message has been deleted

Shawn Vader

unread,
Apr 30, 2014, 6:28:32 AM4/30/14
to play-fr...@googlegroups.com
I have had the same issue and I tracked the problem down to something very stupid on my side. 
I was uploading images and putting them in the play directory so it was obviously compiling as it was getting new directories and files. 
Reply all
Reply to author
Forward
0 new messages