You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/05/09 09:45:08 UTC

[GitHub] [skywalking] tmichnik1981 opened a new issue #2641: Zipkin receiver wrongly deduced whether the spans are compressed (gzipped) or not

tmichnik1981 opened a new issue #2641: Zipkin receiver wrongly deduced whether the spans are compressed (gzipped) or not
URL: https://github.com/apache/skywalking/issues/2641
 
 
   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [*] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   
   ___
   ### Bug
   - Which version of SkyWalking, OS and JRE?
   
   SkyWalking: 6.1.0
   JRE: Jdk8
   OS: win10
   
   zipkin client libs:
   io.zipkin.zipkin2:zipkin:2.11.10
   io.zipkin.reporter2:zipkin-reporter:2.7.13
   
   
   - Which company or project?
   ING Bank Śląski SA 
   
   - What happen?
   
   Zipkin allows to decide whether we want to send compressed or uncopressed spans.
   
   It turned out that  zipkin-receiver-plugin was not able to figure out that the spans were compressed.  In other words compressed data was interpreted as uncompressed which 
   led to exception. 
   
   ```
    java.lang.IllegalArgumentException: Malformed reading List<Span> from json
   	at zipkin2.internal.JsonCodec.exceptionReading(JsonCodec.java:240) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.JsonCodec.readList(JsonCodec.java:155) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.codec.SpanBytesDecoder$3.decodeList(SpanBytesDecoder.java:107) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.codec.SpanBytesDecoder.decodeList(SpanBytesDecoder.java:151) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.codec.SpanBytesDecoder$3.decodeList(SpanBytesDecoder.java:118) ~[zipkin-2.9.1.jar:?]
   	at org.apache.skywalking.oap.server.receiver.zipkin.handler.SpanProcessor.convert(SpanProcessor.java:58) ~[zipkin-receiver-plugin-6.1.0.jar:6.1.0]
   	at org.apache.skywalking.oap.server.receiver.zipkin.handler.SpanV2JettyHandler.doPost(SpanV2JettyHandler.java:70) [zipkin-receiver-plugin-6.1.0.jar:6.1.0]
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0]
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
   	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) [jetty-servlet-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:543) [jetty-servlet-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481) [jetty-servlet-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.Server.handle(Server.java:564) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [jetty-server-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) [jetty-io-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) [jetty-util-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) [jetty-util-9.4.2.v20170220.jar:9.4.2.v20170220]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
   Caused by: zipkin2.internal.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
   	at zipkin2.internal.gson.stream.JsonReader.syntaxError(JsonReader.java:1568) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.gson.stream.JsonReader.checkLenient(JsonReader.java:1409) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.gson.stream.JsonReader.doPeek(JsonReader.java:593) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.gson.stream.JsonReader.beginArray(JsonReader.java:343) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.JsonCodec$JsonReader.beginArray(JsonCodec.java:57) ~[zipkin-2.9.1.jar:?]
   	at zipkin2.internal.JsonCodec.readList(JsonCodec.java:149) ~[zipkin-2.9.1.jar:?]
   	... 26 more 
   ```
   
   I found  in org.apache.skywalking.oap.server.receiver.zipkin.handler.SpanProcessor
   what  probably causes the problem.   
   
   ``` 
   private InputStream getInputStream(HttpServletRequest request) throws IOException {
           InputStream requestInStream;
   
           String headEncoding = request.getHeader("accept-encoding");
           if (headEncoding != null && (headEncoding.indexOf("gzip") != -1)) {
               requestInStream = new GZIPInputStream(request.getInputStream());
           } else {
               requestInStream = request.getInputStream();
           }
   
           return requestInStream;
       }
   ```
   
   Header "accept-encoding" is tested whilst zipkin sends Content-Encoding: gzip in the request.
   
   ___
   ### Requirement or improvement
   - Please describe about your requirements or improvement suggestions.
   
   I think that checking "Content-Encoding" instead of "accept-encoding" should fix the issue.
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services