Closed pwyczes closed 6 years ago
@jroper I was able to somehow plug your reactive-streams-servlet (not everywhere, though) in play2-war. Can you, please, check in some spare time?
Also, I don't know, why in result
from futureResult.map { result =>
there is no Content-Type
header, but I will have to figure it out later (at least if nobody knows out of the box... ;) ).
The content type and length are now properties of the HttpEntity (ie, the result body). You'll have to modify the code that looks for the content length too, assuming it's looking to the response headers to find it:
https://www.playframework.com/documentation/2.6.x/api/scala/index.html#play.api.http.HttpEntity
Thanks @jroper for your help. I appreciate it. :)
I was able to run sbt tomcat7
and hit http://localhost:8080/p2wsample/
- the page loads and the clock is ticking (although not every 100 millis - probably it buffers somewhere).
Sometimes I can see some logs about non-recycled responses
and I have to figure out why they appear.
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] INFO: Encountered a non-recycled response and recycled it forcedly.
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:592)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.http11.AbstractHttp11Processor.recycle(AbstractHttp11Processor.java:1814)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.release(Http11Protocol.java:140)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:703)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.lang.Thread.run(Thread.java:748)
The next steps are to run sbt itt-tomcat7
- but it fails at this moment and produces some NPEs like:
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] SEVERE: null
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] java.lang.NullPointerException
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:304)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:1485)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:776)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.Response.action(Response.java:174)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.Response.sendHeaders(Response.java:348)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:349)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:308)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.catalina.connector.Response.finishResponse(Response.java:553)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:335)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1674)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:604)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[info][org.codehaus.cargo.container.tomcat.Tomcat7xInstalledLocalContainer] at java.lang.Thread.run(Thread.java:748)
and some timeouts:
[info] java.net.SocketTimeoutException: Read timed out
[info] at java.net.SocketInputStream.socketRead0(Native Method)
[info] at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
[info] at java.net.SocketInputStream.read(SocketInputStream.java:171)
[info] at java.net.SocketInputStream.read(SocketInputStream.java:141)
[info] at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160)
[info] at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)
[info] at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:273)
[info] at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
[info] at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
[info] at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
I am trying to figure out what is happening right now, but if you @jroper (or anyone else involved in this project) have any hints, I'll take them all. ;)
Can you rebase on or merge play2war:develop
to get your last changes on this branch? Thx!
done :)
@pwyczes which servlet version do you need? We could maybe start only with the servlet 3.1 version and use https://github.com/jroper/reactive-streams-servlet more deeply.
We need version 3.0. 3.1 is in further plans in this project.
Hi @yanns , I think, I am going to have some time to go back to this topic this (and maybe next) weekend - could you, please, find like 10 minutes to review my previous changes and maybe give me a small hint how to move forward? :) I would really appreciate that. No pressure, though. :)
Finally, I found some time to return to that topic.
I figured out, that those NPEs come from some concurrency issues (https://bz.apache.org/bugzilla/show_bug.cgi?id=47655#c9), since MimeHeaders
is not thread safe.
I returned to using play.api.libs.streams.Execution.Implicits.trampoline
(yes, I am aware of https://github.com/play2war/play2-war-plugin/issues/223) but this still did not help.
When I make one single request, like curl -i http://localhost:8080/p2wsample/sub/subdir
then everything looks fine, but once I start sbt itt-tomcat7
it fails randomly with unrecognized HTTP headers like Invalid header: :21:51 GMT
, or Invalid header: X-Permitted-Cross-Domain-Policiesferrer-Polimaster-only
. This also suggests those concurrency issues.
I have limited experience with akka-streams
, so any suggestion where to look at is more than welcome. :)
Hi @pwyczes , I gave you direct access to https://github.com/play2war/play2-war-plugin. I guess that you're the only chance for this project to survive 😉
I can propose you the following: you can push your current PR into a new branch directly under the repo, so that we can collaboratively work on it. WDYT?
Thank you @yanns :) I will push this PR as you suggested. :)
@yanns I merged my PR to branch 321_play_2_6
.
WIP #321 I was able to compile
sample project
- it runs standalone, butclock
request needs some more work. I also managed to compileproject code
, although I am not sure if did it correctly, since test are failing, and running tomcat7 returns page as text - need some more time (or maybe someone's help) to figure out what is going on. :)I left some
// TODO #321
comments to be cleaned up, after successful migration. Most of them are about deleting commented code, which I left for comparison purposes.PS Any comments are more than welcome! :)