luminus-framework / luminus-framework/luminus
Long response got cut off when `wrap-base`
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 626
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
The url get response data cut:
http://localhost:3000/www/stock/klinedata?stockid=300370.SZ&period=D
the original url:
https://www.joudou.com/stockinfogate/stock/klinedata?stockid=300370.SZ&period=D
The error message are:
2017-05-20 00:19:02,287 [qtp1106269094-16] WARN org.eclipse.jetty.server.HttpChannel - //localhost:3000/www/stock/klinedata?stockid=300370.SZ&period=D
clojure.lang.ExceptionInfo: Couldnt' write to stream
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at qbits.jet.servlet$write_stream_BANG_.invokeStatic(servlet.clj:131)
at qbits.jet.servlet$write_stream_BANG_.invoke(servlet.clj:126)
at qbits.jet.servlet$eval37883$fn__37884.invoke(servlet.clj:153)
at qbits.jet.servlet$eval37796$fn__37797$G__37787__37806.invoke(servlet.clj:88)
at qbits.jet.servlet$set_response_body_BANG_.invokeStatic(servlet.clj:93)
at qbits.jet.servlet$set_response_body_BANG_.invoke(servlet.clj:91)
at qbits.jet.servlet$set_body_BANG_.invokeStatic(servlet.clj:229)
at qbits.jet.servlet$set_body_BANG_.invoke(servlet.clj:220)
at qbits.jet.servlet$eval38053$fn__38054.invoke(servlet.clj:263)
at qbits.jet.servlet$eval38024$fn__38025$G__38015__38032.invoke(servlet.clj:236)
at qbits.jet.servlet$update_response.invokeStatic(servlet.clj:241)
at qbits.jet.servlet$update_response.invoke(servlet.clj:239)
at qbits.jet.server$make_handler$fn__38414.invoke(server.clj:78)
at qbits.jet.server.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:518)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
I use the following handler:
```clojure
(def app-routes
(routes
(-> #'home-routes
(wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats))
(middleware/wrap-proxy
(route/not-found
(:body
(error-page {:status 404
:title "page not found"}))))))
(defn app [] (middleware/wrap-base #'app-routes))
```
I add the `wrap-proxy` to get response from another server.
I tried to get the raw req and `client/request` the req, then I got the full response in REPL. So I am sure that the response got by the function returned by `wrap-proxy` is the complete. Is this because of something in the `wrap-base` who cause the response to be cut off?
Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with middleware/wrap-base and middleware/wrap-proxy, then inspect qbits.jet.servlet/write_stream_BANG_ at servlet.clj:126-153. Reproduce the stock klinedata request with the proxied response and compare it with the complete response obtained through client/request in a REPL. Done means identifying why the wrapped response is truncated and confirming the full response is delivered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100