diff --git a/jetty-http2/http2-common/src/test/resources/jetty-logging.properties b/jetty-http2/http2-common/src/test/resources/jetty-logging.properties new file mode 100644 index 00000000000..31b37987e9a --- /dev/null +++ b/jetty-http2/http2-common/src/test/resources/jetty-logging.properties @@ -0,0 +1,10 @@ +org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog +org.eclipse.jetty.LEVEL=INFO +org.eclipse.jetty.STACKS=true +org.eclipse.jetty.SOURCE=false +org.eclipse.jetty.http2.hpack.LEVEL=debug +#org.eclipse.jetty.spdy.LEVEL=DEBUG +#org.eclipse.jetty.server.LEVEL=DEBUG +#org.eclipse.jetty.io.LEVEL=DEBUG +#org.eclipse.jetty.io.ssl.LEVEL=DEBUG +#org.eclipse.jetty.spdy.server.LEVEL=DEBUG diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java index 846ab01cda7..9e1af505991 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackContext.java @@ -179,17 +179,19 @@ public class HpackContext } }; - HpackContext(int maxHeaderTableSize) { _maxHeaderTableSizeInBytes=maxHeaderTableSize; int guesstimateEntries = 10+maxHeaderTableSize/(32+10+10); _headerTable=new HeaderTable(guesstimateEntries,guesstimateEntries+10); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("HdrTbl[%x] created max=%d",hashCode(),maxHeaderTableSize)); } public void resize(int newMaxHeaderTableSize) { - LOG.debug("HdrTbl resized {}",newMaxHeaderTableSize); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("HdrTbl[%x] resized max=%d->%d",hashCode(),_maxHeaderTableSizeInBytes,newMaxHeaderTableSize)); _maxHeaderTableSizeInBytes=newMaxHeaderTableSize; int guesstimateEntries = 10+newMaxHeaderTableSize/(32+10+10); evict(); @@ -232,7 +234,8 @@ public class HpackContext int size = entry.getSize(); if (size>_maxHeaderTableSizeInBytes) { - LOG.debug("!added {} too big",field); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("HdrTbl[%x] !added size %d>%d",hashCode(),size,_maxHeaderTableSizeInBytes)); return null; } _headerTableSizeInBytes+=size; @@ -240,7 +243,8 @@ public class HpackContext _fieldMap.put(field,entry); _nameMap.put(StringUtil.asciiToLowerCase(field.getName()),entry); - LOG.debug("HdrTbl added {}",entry); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("HdrTbl[%x] added %s",hashCode(),entry)); evict(); return entry; } @@ -290,7 +294,8 @@ public class HpackContext public void clearReferenceSet() { - LOG.debug("RefSet cleared"); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("RefSet[%x] cleared",hashCode())); Entry entry = _refSet._refSetNext; while(entry!=_refSet) { @@ -312,7 +317,8 @@ public class HpackContext entry._used=false; else { - LOG.debug("RefSet remove unused {}",entry); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("RefSet[%x] remove unused",hashCode(),entry)); // encode the reference to remove it buffer.put((byte)0x80); NBitInteger.encode(buffer,7,index(entry)); @@ -331,7 +337,8 @@ public class HpackContext entry._used=false; else { - LOG.debug("RefSet emit unused {}",entry); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("RefSet[%x] emit unref",hashCode(),entry)); builder.emit(entry.getHttpField()); } @@ -378,7 +385,8 @@ public class HpackContext while (_headerTableSizeInBytes>_maxHeaderTableSizeInBytes) { Entry entry = _headerTable.pollUnsafe(); - LOG.debug("HdrTbl evict {}",entry); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("HdrTbl[%x] evict %s",hashCode(),entry)); _headerTableSizeInBytes-=entry.getSize(); entry.removeFromRefSet(); entry._index=-1; @@ -497,7 +505,8 @@ public class HpackContext _refSetPrev=ctx._refSet._refSetPrev; ctx._refSet._refSetPrev._refSetNext=this; ctx._refSet._refSetPrev=this; - LOG.debug("RefSet added {}",this); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("RefSet[%x] added",ctx.hashCode(),this)); } public boolean isInReferenceSet() @@ -507,7 +516,8 @@ public class HpackContext public void removeFromRefSet() { - LOG.debug("RefSet remove {}",this); + if (LOG.isDebugEnabled()) + LOG.debug(String.format("RefSet[?] remove %s",this)); if (_refSetNext!=this) { _refSetNext._refSetPrev=_refSetPrev; diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java index fa7fbe08eb2..e74f80e8931 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java @@ -63,10 +63,12 @@ public class HpackDecoder public MetaData decode(ByteBuffer buffer) { + if (LOG.isDebugEnabled()) + LOG.debug(String.format("CtxTbl[%x] decoding",_context.hashCode())); while(buffer.hasRemaining()) { if (LOG.isDebugEnabled()) - { + { int l=Math.min(buffer.remaining(),16); LOG.debug("decode "+TypeUtil.toHexString(buffer.array(),buffer.arrayOffset()+buffer.position(),l)+(l