toolkits / pkg Goto Github PK
View Code? Open in Web Editor NEWgolang pkg
License: Apache License 2.0
golang pkg
License: Apache License 2.0
example: i need to translate "我" to "i", cant implement
错误日志:
rgw.Transfergw/JobGetTaskMeta - {\"id\":18355}","trace":"bfd62bf1dc671141","span":"0"}
fatal error: concurrent map iteration and map write
goroutine 1569 [running]:
runtime.throw(0xec44fa, 0x26)
/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc0011e66c0 sp=0xc0011e6690 pc=0x436bc2
runtime.mapiternext(0xc0017a9c80)
/usr/local/go/src/runtime/map.go:853 +0x552 fp=0xc0011e6740 sp=0xc0011e66c0 pc=0x411312
reflect.mapiternext(0xc0017a9c80)
/usr/local/go/src/runtime/map.go:1337 +0x2b fp=0xc0011e6758 sp=0xc0011e6740 pc=0x41228b
reflect.(*MapIter).Next(0xc0068e80e0, 0xd58900)
/usr/local/go/src/reflect/value.go:1261 +0xdb fp=0xc0011e6780 sp=0xc0011e6758 pc=0x49c92b
internal/fmtsort.Sort(0xd67720, 0xc000280468, 0x1b5, 0x2)
/usr/local/go/src/internal/fmtsort/sort.go:63 +0x1aa fp=0xc0011e6838 sp=0xc0011e6780 pc=0x4ae91a
fmt.(*pp).printValue(0xc0063e5860, 0xd67720, 0xc000280468, 0x1b5, 0x76, 0x2)
/usr/local/go/src/fmt/print.go:773 +0xcd4 fp=0xc0011e6a10 sp=0xc0011e6838 pc=0x4e3134
fmt.(*pp).printValue(0xc0063e5860, 0xe433e0, 0xc000280420, 0x199, 0xc000000076, 0x1)
/usr/local/go/src/fmt/print.go:810 +0x1ab9 fp=0xc0011e6be8 sp=0xc0011e6a10 pc=0x4e3f19
fmt.(*pp).printValue(0xc0063e5860, 0xdcb340, 0xc000280420, 0x16, 0x76, 0x0)
/usr/local/go/src/fmt/print.go:880 +0x18be fp=0xc0011e6dc0 sp=0xc0011e6be8 pc=0x4e3d1e
fmt.(*pp).printArg(0xc0063e5860, 0xdcb340, 0xc000280420, 0x76)
/usr/local/go/src/fmt/print.go:716 +0x292 fp=0xc0011e6e58 sp=0xc0011e6dc0 pc=0x4e1d32
fmt.(*pp).doPrintf(0xc0063e5860, 0xeb9dde, 0x1d, 0xc0011e7050, 0x2, 0x2)
/usr/local/go/src/fmt/print.go:1030 +0x15a fp=0xc0011e6f40 sp=0xc0011e6e58 pc=0x4e552a
fmt.Sprintf(0xeb9dde, 0x1d, 0xc0011e7050, 0x2, 0x2, 0xc00103d401, 0xc0050e2660)
/usr/local/go/src/fmt/print.go:219 +0x66 fp=0xc0011e6f98 sp=0xc0011e6f40 pc=0x4de576
log.Printf(0xeb9dde, 0x1d, 0xc0011e7050, 0x2, 0x2)
/usr/local/go/src/log/log.go:320 +0x53 fp=0xc0011e6fe0 sp=0xc0011e6f98 pc=0x659423
github.com/toolkits/pkg/net/gobrpc.(*RPCClient).Call(0xc00028e840, 0xeb28d9, 0x15, 0xcfac00, 0xc0003772d8, 0xce33c0, 0xc0002743f8, 0xc0011e7140, 0x1, 0x1, ...)
/root/go/pkg/mod/github.com/toolkits/pkg@v1.1.3/net/gobrpc/client.go:59 +0x262 fp=0xc0011e70d0 sp=0xc0011e6fe0 pc=0xc00682
mq.code.sangfor.org/CMP/aOPS/transfer-gateway/internal/thirdpartyclient.(*RpcClient).SafeCall(0xc000286540, 0xeb28d9, 0x15, 0xcfac00, 0xc0003772d8, 0xce33c0, 0xc0002743f8, 0x12a05f200, 0xc0003772d8, 0xc0011e7248)
/root/go/src/mq.code.sangfor.org/CMP/aOPS/transfer-gateway/internal/thirdpartyclient/client.go:80 +0xc3 fp=0xc0011e71d0 sp=0xc0011e70d0 pc=0xc01003
mq.code.sangfor.org/CMP/aOPS/transfer-gateway/internal/thirdpartyclient/job.(*Job).GetTaskMeta(0xc00028a270, 0xc0003772d8, 0x10, 0xcfac00, 0xc0003772d8)
问题点出现在:
func (c *RPCClient) Call(method string, args interface{}, reply interface{}, callTimeout ...time.Duration) error {
done := make(chan error, 1)
go func() {
err := c.rpcClient.Call(method, args, reply)
done <- err
}()
timeout := c.callTimeout
if len(callTimeout) > 0 {
timeout = callTimeout[0]
}
select {
case <-time.After(timeout):
log.Printf("[W] rpc call timeout %v => %v", c.rpcClient, c.address) //这个打印log会打印rpcclient 导致map读写并发冲突
return fmt.Errorf("timeout")
case err := <-done:
return err
}
return nil
}
error:
D:\Go\pkg\mod\github.com\toolkits\[email protected]\logger\config.go:37:32: cannot use sb (variable of type *syslogBackend) as type Backend in argument to log.SetLogging:
*syslogBackend does not implement Backend (missing Close method)
have close()
want Close()
please fix the code with Close() not close()
CentOS 8.X
Total: 509
TCP: 129 (estab 32, closed 79, orphaned 0, timewait 17)
Transport Total IP IPv6
RAW 0 0 0
UDP 6 4 2
TCP 50 25 25
INET 56 29 27
FRAG 0 0 0
CentOS 6.X or CentOS 7.X
Total: 2991 (kernel 7497)
TCP: 32 (estab 8, closed 5, orphaned 0, synrecv 0, timewait 4/0), ports 0
Transport Total IP IPv6
7497 - -
RAW 0 0 0
UDP 18 11 7
TCP 27 19 8
INET 45 30 15
FRAG 0 0 0
ss_s.go slabinfo.timewait
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.