Comments (3)
not sure if it's related to how early is the connection at all, it seems to crash as soon as it gets a connection.
I applied #30 but it didn't work
diff --git a/vendor/github.com/soheilhy/cmux/patricia.go b/vendor/github.com/soheilhy/cmux/patricia.go
index 0099e38..a38cae0 100644
--- a/vendor/github.com/soheilhy/cmux/patricia.go
+++ b/vendor/github.com/soheilhy/cmux/patricia.go
@@ -22,8 +22,8 @@ import (
// patriciaTree is a simple patricia tree that handles []byte instead of string
// and cannot be changed after instantiation.
type patriciaTree struct {
- root *ptNode
- buf []byte // preallocated buffer to read data while matching
+ root *ptNode
+ maxDepth int // max depth of the tree.
}
func newPatriciaTree(bs ...[]byte) *patriciaTree {
@@ -34,8 +34,8 @@ func newPatriciaTree(bs ...[]byte) *patriciaTree {
}
}
return &patriciaTree{
- root: newNode(bs),
- buf: make([]byte, max+1),
+ root: newNode(bs),
+ maxDepth: max + 1,
}
}
@@ -48,13 +48,15 @@ func newPatriciaTreeString(strs ...string) *patriciaTree {
}
func (t *patriciaTree) matchPrefix(r io.Reader) bool {
- n, _ := io.ReadFull(r, t.buf)
- return t.root.match(t.buf[:n], true)
+ buf := make([]byte, t.maxDepth)
+ n, _ := io.ReadFull(r, buf)
+ return t.root.match(buf[:n], true)
}
func (t *patriciaTree) match(r io.Reader) bool {
- n, _ := io.ReadFull(r, t.buf)
- return t.root.match(t.buf[:n], false)
+ buf := make([]byte, t.maxDepth)
+ n, _ := io.ReadFull(r, buf)
+ return t.root.match(buf[:n], false)
}
type ptNode struct {
2016/07/15 07:06:58 starting the HTTP/HTTPS/gRPC server bound to ":8091"
panic: runtime error: index out of range
goroutine 87 [running]:
panic(0xf203a0, 0xc820014010)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.(*ptNode).match(0xc82051d950, 0xc82054d388, 0x0, 0x8, 0x1, 0x0)
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/patricia.go:164 +0x1f0
github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.(*patriciaTree).matchPrefix(0xc8205596f0, 0x7fa00d2bcc28, 0xc8202766d0, 0x40cfca)
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/patricia.go:53 +0xd7
github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.(*patriciaTree).(github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.matchPrefix)-fm(0x7fa00d2bcc28, 0xc8202766d0, 0x7fa00d2a85b0)
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/matchers.go:37 +0x34
github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.matchersToMatchWriters.func1(0x7fa00d2a85b0, 0xc820022518, 0x7fa00d2bcc28, 0xc8202766d0, 0xc820022518)
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/cmux.go:112 +0x32
github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.(*cMux).serve(0xc8202a5000, 0x7fa00d2a7e90, 0xc820022518, 0xc82029b200, 0xc820559730)
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/cmux.go:168 +0x33e
created by github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux.(*cMux).Serve
/go/src/github.com/publica-project/grpc-logger/vendor/github.com/soheilhy/cmux/cmux.go:158 +0x188
from cmux.
Thanks for the bug report! Can you please check if #33 fixes the issue for you?
from cmux.
#33 fixed the issue.
from cmux.
Related Issues (20)
- Upgrade the x/net version in dependencies?
- Server unexpectedly doesn't receive traffic from cmux.Any() HOT 1
- Udp support?
- Add benchmarks
- badly-behaved client can deadlock server stopping HOT 3
- Cannot get Matchers to mux h2c gRPC and HTTP2(REST) requests HOT 4
- It's hard to extend protocol HOT 3
- how to write client codeto gprc connect HOT 2
- Doesn't work with grpc-go's hello world example HOT 2
- Pull In Downstream Fixes HOT 1
- Cannot check closed error with errors.Is HOT 1
- Multiplexing gRPC and Prometheus metrics services using Google Cloud Run
- Matching based on URL HOT 1
- Cmux example HOT 1
- Close not working properly on gRPC graceful stop HOT 1
- Multiplexing gRPC & HTTP handlers with H2C+Prior Knowledge HOT 4
- socks5 matcher not working HOT 2
- http2 matcher not working with net/http HOT 2
- I don't understand why calling source.Read() might block?
- HTTP1Fast matcher omits PATCH HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmux.