bfenetworks/bfe

failed to build from src

zhudy opened this issue · 1 comments

zhudy commented

Describe the bug
Failed to build from source code, both AMD64 and ARM64 Platform, same error

To Reproduce
wget https://go.dev/dl/go1.18.2.linux-amd64.tar.gz
//https://go.dev/doc/install
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

$ go env -w GOPROXY=https://goproxy.cn
$ make
go: downloading github.com/baidu/go-lib v0.0.0-20200819072111-21df249f5e6a
go: downloading go.uber.org/automaxprocs v1.4.0
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading gopkg.in/gcfg.v1 v1.2.3
go: downloading github.com/armon/go-radix v1.0.0
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
go: downloading github.com/abbot/go-http-auth v0.4.1-0.20181019201920-860ed7f246ff
go: downloading github.com/golang-jwt/jwt v3.2.2+incompatible
go: downloading gopkg.in/square/go-jose.v2 v2.4.1
go: downloading github.com/andybalholm/brotli v1.0.0
go: downloading github.com/miekg/dns v1.1.29
go: downloading github.com/oschwald/geoip2-golang v1.4.0
go: downloading github.com/microcosm-cc/bluemonday v1.0.16
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/opentracing/opentracing-go v1.1.0
go: downloading go.elastic.co/apm v1.11.0
go: downloading go.elastic.co/apm/module/apmot v1.7.2
go: downloading github.com/uber/jaeger-client-go v2.22.1+incompatible
go: downloading github.com/uber/jaeger-lib v2.2.0+incompatible
go: downloading github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
go: downloading github.com/openzipkin/zipkin-go v0.2.2
go: downloading github.com/gomodule/redigo v2.0.0+incompatible
go: downloading github.com/tjfoc/gmsm v1.3.2
go: downloading golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
go: downloading github.com/json-iterator/go v1.1.10
go: downloading github.com/zmap/go-iptree v0.0.0-20170831022036-1948b1097e25
go: downloading github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869
go: downloading gopkg.in/warnings.v0 v0.1.2
go: downloading github.com/oschwald/maxminddb-golang v1.6.0
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/elastic/go-sysinfo v1.1.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading go.elastic.co/fastjson v1.1.0
go: downloading go.elastic.co/apm/module/apmhttp v1.7.2
go: downloading go.uber.org/atomic v1.6.0
go: downloading github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492
go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: downloading github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: downloading github.com/asergeyev/nradix v0.0.0-20170505151046-3872ab85bb56
go: downloading golang.org/x/text v0.3.7
go: downloading github.com/gorilla/css v1.0.0
go: downloading google.golang.org/grpc v1.22.1
go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb
go: downloading github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901
go: downloading github.com/prometheus/procfs v0.0.3
installing goyacc
go install golang.org/x/tools/cmd/goyacc
go: downloading golang.org/x/tools v0.1.8
goyacc installed
cd "bfe_basic/condition/parser" && go generate
go test -race -cover ./...
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
? github.com/bfenetworks/bfe [no test files]
ok github.com/bfenetworks/bfe/bfe_balance 0.049s coverage: 64.3% of statements
ok github.com/bfenetworks/bfe/bfe_balance/backend 0.048s coverage: 60.5% of statements
ok github.com/bfenetworks/bfe/bfe_balance/bal_gslb 0.037s coverage: 32.8% of statements
ok github.com/bfenetworks/bfe/bfe_balance/bal_slb 0.036s coverage: 72.9% of statements
? github.com/bfenetworks/bfe/bfe_basic [no test files]
ok github.com/bfenetworks/bfe/bfe_basic/action 0.035s coverage: 77.5% of statements
ok github.com/bfenetworks/bfe/bfe_basic/condition 0.041s coverage: 46.8% of statements
ok github.com/bfenetworks/bfe/bfe_basic/condition/parser 0.054s coverage: 47.5% of statements
ok github.com/bfenetworks/bfe/bfe_bufio 0.513s coverage: 89.3% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_cluster_conf/cluster_conf 0.034s coverage: 66.3% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_cluster_conf/cluster_table_conf 0.021s coverage: 36.8% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_cluster_conf/gslb_conf 0.034s coverage: 49.1% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_conf 0.132s coverage: 70.5% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_route_conf/host_rule_conf 0.032s coverage: 76.8% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_route_conf/route_rule_conf 0.045s coverage: 91.3% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_route_conf/vip_rule_conf 0.030s coverage: 90.3% of statements
? github.com/bfenetworks/bfe/bfe_config/bfe_tls_conf/server_cert_conf [no test files]
ok github.com/bfenetworks/bfe/bfe_config/bfe_tls_conf/session_ticket_key_conf 0.027s coverage: 56.2% of statements
ok github.com/bfenetworks/bfe/bfe_config/bfe_tls_conf/tls_rule_conf 0.047s coverage: 50.7% of statements
? github.com/bfenetworks/bfe/bfe_debug [no test files]
ok github.com/bfenetworks/bfe/bfe_fcgi 0.045s coverage: 66.4% of statements
ok github.com/bfenetworks/bfe/bfe_http 1.509s coverage: 48.7% of statements
? github.com/bfenetworks/bfe/bfe_http/httputil [no test files]
ok github.com/bfenetworks/bfe/bfe_http2 5.667s coverage: 79.3% of statements
ok github.com/bfenetworks/bfe/bfe_http2/hpack 1.448s coverage: 85.6% of statements
--- FAIL: TestBfeCallbacksModuleHandlersGetJSON (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1 pc=0x9c97fe]

goroutine 11 [running]:
testing.tRunner.func1.2({0xe690c0, 0x1344c90})
/usr/local/go/src/testing/testing.go:1389 +0x366
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1392 +0x5d2
panic({0xe690c0, 0x1344c90})
/usr/local/go/src/runtime/panic.go:844 +0x258
github.com/modern-go/reflect2.(*UnsafeMapIterator).HasNext(0xc00008fa70)
/home/ubuntu/go/pkg/mod/github.com/modern-go/reflect2@v0.0.0-20180701023420-4b7aa43c6742/unsafe_map.go:125 +0x3e
github.com/json-iterator/go.(*sortKeysMapEncoder).Encode(0xc000149ad0, 0xc0000108a0, 0xc000068540)
/home/ubuntu/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_map.go:296 +0x7c5
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc00014cf00, 0xc0001498f0, 0xc000160bc0?)
/home/ubuntu/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:219 +0xa4
github.com/json-iterator/go.(*Stream).WriteVal(0xc000068540, {0xe63be0, 0xc0001498f0})
/home/ubuntu/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:98 +0x1f8
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc0000a23c0, {0xe63be0, 0xc0001498f0})
/home/ubuntu/go/pkg/mod/github.com/json-iterator/go@v1.1.10/config.go:299 +0xfa
github.com/bfenetworks/bfe/bfe_util/json.Marshal(...)
/home/ubuntu/david/bfe/bfe/bfe_util/json/json.go:34
github.com/bfenetworks/bfe/bfe_module.(*BfeCallbacks).ModuleHandlersGetJSON(0xc000010840)
/home/ubuntu/david/bfe/bfe/bfe_module/bfe_callback.go:153 +0x30f
github.com/bfenetworks/bfe/bfe_module.TestBfeCallbacksModuleHandlersGetJSON(0x0?)
/home/ubuntu/david/bfe/bfe/bfe_module/bfe_callback_test.go:108 +0x5e
testing.tRunner(0xc000180b60, 0xf2f490)
/usr/local/go/src/testing/testing.go:1439 +0x214
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1486 +0x725
FAIL github.com/bfenetworks/bfe/bfe_module 0.034s
? github.com/bfenetworks/bfe/bfe_modules [no test files]
ok github.com/bfenetworks/bfe/bfe_modules/mod_access 0.037s coverage: 6.1% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_auth_basic 0.048s coverage: 80.3% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_auth_jwt 0.055s coverage: 81.8% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_auth_request 0.049s coverage: 78.7% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_block 0.051s coverage: 80.9% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_compress 0.109s coverage: 69.1% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_cors 0.035s coverage: 77.4% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_doh 0.054s coverage: 65.3% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_errors 0.040s coverage: 11.4% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_geo 0.038s coverage: 78.8% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_header 0.076s coverage: 57.0% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_http_code 0.053s coverage: 64.3% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_key_log 0.037s coverage: 39.4% of statements
? github.com/bfenetworks/bfe/bfe_modules/mod_logid [no test files]
ok github.com/bfenetworks/bfe/bfe_modules/mod_markdown 0.108s coverage: 85.9% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_prison 1.062s coverage: 24.5% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_redirect 0.034s coverage: 81.2% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_rewrite 0.039s coverage: 58.9% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_secure_link 0.049s coverage: 71.6% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_static 0.093s coverage: 84.3% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_tag 0.051s coverage: 85.6% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_tcp_keepalive 0.066s coverage: 72.9% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_trace 0.078s coverage: 70.6% of statements
? github.com/bfenetworks/bfe/bfe_modules/mod_trace/trace [no test files]
? github.com/bfenetworks/bfe/bfe_modules/mod_trace/trace/elastic [no test files]
? github.com/bfenetworks/bfe/bfe_modules/mod_trace/trace/jaeger [no test files]
? github.com/bfenetworks/bfe/bfe_modules/mod_trace/trace/zipkin [no test files]
ok github.com/bfenetworks/bfe/bfe_modules/mod_trust_clientip 0.044s coverage: 65.7% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_userid 1.063s coverage: 73.3% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_waf 0.055s coverage: 84.4% of statements
ok github.com/bfenetworks/bfe/bfe_modules/mod_waf/waf_rule 0.038s coverage: 78.6% of statements
ok github.com/bfenetworks/bfe/bfe_net/textproto 0.027s coverage: 70.8% of statements
ok github.com/bfenetworks/bfe/bfe_proxy 0.249s coverage: 90.2% of statements
ok github.com/bfenetworks/bfe/bfe_route 0.038s coverage: 10.6% of statements
? github.com/bfenetworks/bfe/bfe_route/bfe_cluster [no test files]
ok github.com/bfenetworks/bfe/bfe_route/trie 0.017s coverage: 96.4% of statements
ok github.com/bfenetworks/bfe/bfe_server 0.106s coverage: 0.1% of statements
ok github.com/bfenetworks/bfe/bfe_spdy 4.675s coverage: 77.5% of statements
ok github.com/bfenetworks/bfe/bfe_stream 4.700s coverage: 89.0% of statements
ok github.com/bfenetworks/bfe/bfe_tls 2.049s coverage: 76.7% of statements
ok github.com/bfenetworks/bfe/bfe_util 0.078s coverage: 23.3% of statements
ok github.com/bfenetworks/bfe/bfe_util/access_log 0.039s coverage: 22.6% of statements
ok github.com/bfenetworks/bfe/bfe_util/bns 0.021s coverage: 66.7% of statements
ok github.com/bfenetworks/bfe/bfe_util/byte_pool 0.023s coverage: 100.0% of statements
ok github.com/bfenetworks/bfe/bfe_util/hash_set 0.040s coverage: 90.6% of statements
ok github.com/bfenetworks/bfe/bfe_util/ipdict 0.045s coverage: 87.6% of statements
ok github.com/bfenetworks/bfe/bfe_util/ipdict/txt_load 0.041s coverage: 82.9% of statements
ok github.com/bfenetworks/bfe/bfe_util/json 0.034s coverage: 85.7% of statements
ok github.com/bfenetworks/bfe/bfe_util/net_util 0.030s coverage: 34.5% of statements
ok github.com/bfenetworks/bfe/bfe_util/pipe 0.018s coverage: 66.3% of statements
ok github.com/bfenetworks/bfe/bfe_util/semver 0.018s coverage: 72.7% of statements
ok github.com/bfenetworks/bfe/bfe_util/signal_table 0.025s coverage: 31.2% of statements
? github.com/bfenetworks/bfe/bfe_util/string_reverse [no test files]
ok github.com/bfenetworks/bfe/bfe_websocket 4.570s coverage: 86.4% of statements
FAIL
make: *** [Makefile:93: test-case] Error 1

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
错误提示不明确,如何算是正常编译成功?

daimg commented

There is panic in running test case:

--- FAIL: TestBfeCallbacksModuleHandlersGetJSON (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1 pc=0x9c97fe]

Seems to be an issue of json-iterator in golang 1.18 for arm build:
json-iterator/go#614

We have to upgrade the dependency version to fix it.