Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fortio for openSUSE:Factory checked in at 2022-05-24 20:31:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fortio (Old) and /work/SRC/openSUSE:Factory/.fortio.new.2254 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fortio" Tue May 24 20:31:42 2022 rev:13 rq:978878 version:1.32.0 Changes: -------- --- /work/SRC/openSUSE:Factory/fortio/fortio.changes 2022-05-20 17:52:17.627311632 +0200 +++ /work/SRC/openSUSE:Factory/.fortio.new.2254/fortio.changes 2022-05-24 20:32:16.346967894 +0200 @@ -1,0 +2,6 @@ +Tue May 24 07:50:11 UTC 2022 - ka...@b1-systems.de + +- Update to version 1.32.0: + * dns cache lock fix, tls grpc test restoration, bug fix for -sync error case and increased timeout (#578) + +------------------------------------------------------------------- Old: ---- fortio-1.31.0.tar.gz New: ---- fortio-1.32.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fortio.spec ++++++ --- /var/tmp/diff_new_pack.Ao4vxB/_old 2022-05-24 20:32:16.918968405 +0200 +++ /var/tmp/diff_new_pack.Ao4vxB/_new 2022-05-24 20:32:16.922968408 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: fortio -Version: 1.31.0 +Version: 1.32.0 Release: 0 Summary: Load testing library, command line tool, advanced echo server and web UI License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Ao4vxB/_old 2022-05-24 20:32:16.958968440 +0200 +++ /var/tmp/diff_new_pack.Ao4vxB/_new 2022-05-24 20:32:16.962968444 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/fortio/fortio</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v1.31.0</param> + <param name="revision">v1.32.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> @@ -17,7 +17,7 @@ <param name="compression">gz</param> </service> <service name="go_modules" mode="disabled"> - <param name="archive">fortio-1.31.0.tar.gz</param> + <param name="archive">fortio-1.32.0.tar.gz</param> </service> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.Ao4vxB/_old 2022-05-24 20:32:16.982968462 +0200 +++ /var/tmp/diff_new_pack.Ao4vxB/_new 2022-05-24 20:32:16.982968462 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/fortio/fortio</param> - <param name="changesrevision">a9397d43c1e2081cc15c6ccae93d08542f9801d5</param></service></servicedata> + <param name="changesrevision">642dc5ba79194deed3f82eee70b6367e3ab3122e</param></service></servicedata> (No newline at EOF) ++++++ fortio-1.31.0.tar.gz -> fortio-1.32.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/README.md new/fortio-1.32.0/README.md --- old/fortio-1.31.0/README.md 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/README.md 2022-05-22 06:41:43.000000000 +0200 @@ -10,7 +10,7 @@ [](https://hub.docker.com/r/fortio/fortio) <img src="./ui/static/img/fortio-logo-gradient-no-bg.svg" height=109 width=167 align=right /> -Fortio (????????????) started as, and is, [Istio](https://istio.io/)'s load testing tool and now graduated to be its own project. +Fortio (????????????) started as, and is, [Istio](https://istio.io/)'s load testing tool and later (2018) graduated to be its own project. Fortio is also used by, among others, [Meshery](https://docs.meshery.io/extensibility/load-generators) @@ -20,7 +20,7 @@ The name fortio comes from greek [????????????](https://fortio.org/fortio.mp3) which means load/burden. -Fortio is a fast, small (3Mb docker image, minimal dependencies), reusable, embeddable go library as well as a command line tool and server process, +Fortio is a fast, small (4Mb docker image, minimal dependencies), reusable, embeddable go library as well as a command line tool and server process, the server includes a simple web UI and REST API to trigger run and see graphical representation of the results (both a single latency graph and a multiple results comparative min, max, avg, qps and percentiles graphs). Fortio also includes a set of server side features (similar to httpbin) to help debugging and testing: request echo back including headers, adding latency or error codes with a probability distribution, tcp echoing, tcp proxying, http fan out/scatter and gather proxy server, GRPC echo/health in addition to http, etc... @@ -31,6 +31,8 @@ Fortio components can be used a library even for unrelated projects, for instance the `log`, `stats`, or `fhttp` utilities both client and server. As well as the newly integrated [Dynamic Flags](dflag/) support (greatly inspired/imported initially from https://github.com/mwitkow/go-flagz) +If you want to connect to fortio using https and fortio to provide real TLS certificates, or to multiplex grpc and regular http behind a single port, check out [Fortio Proxy](https://github.com/fortio/proxy#fortio-proxy) + ## Installation We publish a multi architecture docker image (linux/amd64, linux/arm64, linux/ppc64le, linux/s390x) `fortio/fortio` @@ -50,13 +52,13 @@ The [releases](https://github.com/fortio/fortio/releases) page has binaries for many OS/architecture combinations (see assets). ```shell -curl -L https://github.com/fortio/fortio/releases/download/v1.31.0/fortio-linux_amd64-1.31.0.tgz \ +curl -L https://github.com/fortio/fortio/releases/download/v1.32.0/fortio-linux_amd64-1.32.0.tgz \ | sudo tar -C / -xvzpf - # or the debian package -wget https://github.com/fortio/fortio/releases/download/v1.31.0/fortio_1.31.0_amd64.deb -dpkg -i fortio_1.31.0_amd64.deb +wget https://github.com/fortio/fortio/releases/download/v1.32.0/fortio_1.32.0_amd64.deb +dpkg -i fortio_1.32.0_amd64.deb # or the rpm -rpm -i https://github.com/fortio/fortio/releases/download/v1.31.0/fortio-1.31.0-1.x86_64.rpm +rpm -i https://github.com/fortio/fortio/releases/download/v1.32.0/fortio-1.32.0-1.x86_64.rpm # and more, see assets in release page ``` @@ -66,7 +68,7 @@ brew install fortio ``` -On Windows, download https://github.com/fortio/fortio/releases/download/v1.31.0/fortio_win_1.31.0.zip and extract `fortio.exe` to any location, then using the Windows Command Prompt: +On Windows, download https://github.com/fortio/fortio/releases/download/v1.32.0/fortio_win_1.32.0.zip and extract `fortio.exe` to any location, then using the Windows Command Prompt: ``` fortio.exe server ``` @@ -114,7 +116,7 @@ <details> <!-- use release/updateFlags.sh to update this section --> <pre> -???????????? 1.31.0 usage: +???????????? 1.32.0 usage: where command is one of: load (load testing), server (starts ui, http-echo, redirect, proxies, tcp-echo and grpc ping servers), tcp-echo (only the tcp-echo server), report (report only UI server), redirect (only the redirect server), @@ -593,12 +595,17 @@ `grpcping` can connect to a non-Fortio TLS server by prefacing the destination with `https://`: ```Shell -$ fortio grpcping https://fortio.istio.io -11:07:55 I grpcrunner.go:275> stripping https scheme. grpc destination: fortio.istio.io. grpc port: 443 -Clock skew histogram usec : count 1 avg 12329.795 +/- 0 min 12329.795 max 12329.795 sum 12329.795 +$ fortio grpcping https://grpc.fortio.org +13:48:20 I grpcrunner.go:276> stripping https scheme. grpc destination: grpc.fortio.org. grpc port: 443 +13:48:26 I pingsrv.go:152> Ping RTT 63101562 (avg of 63577000, 63192688, 62535000 ns) clock skew 32021375 +Clock skew histogram usec : count 1 avg 32021.375 +/- 0 min 32021.375 max 32021.375 sum 32021.375 +# range, mid point, percentile, count +>= 32021.4 <= 32021.4 , 32021.4 , 100.00, 1 +# target 50% 32021.4 +RTT histogram usec : count 3 avg 63101.563 +/- 430.2 min 62535 max 63577 sum 189304.688 # range, mid point, percentile, count ->= 12329.8 <= 12329.8 , 12329.8 , 100.00, 1 -# target 50% 12329.8 +>= 62535 <= 63577 , 63056 , 100.00, 3 +# target 50% 62795.5 ``` ### Simple load test @@ -942,7 +949,7 @@ If you have json files saved from running the full UI or downloaded, using the `-sync` option, from an amazon or google cloud storage bucket or from a peer fortio server (to synchronize from a peer fortio, use `http://`_peer_`:8080/data/index.tsv` as the sync URL). You can then serve just the reports: ```Shell -$ fortio report -sync-interval 15m -sync http://storage.googleapis.com:443/fortio-data?prefix=fortio.istio.io/ +$ fortio report -sync-interval 15m -sync "https://storage.googleapis.com/fortio-data?prefix=fortio.istio.io/" Browse only UI starting - visit: http://localhost:8080/ Https redirector running on :8081 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/bincommon/commonflags.go new/fortio-1.32.0/bincommon/commonflags.go --- old/fortio-1.31.0/bincommon/commonflags.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/bincommon/commonflags.go 2022-05-22 06:41:43.000000000 +0200 @@ -125,7 +125,7 @@ // so `fortio version -s` is the short version; everything else is long/full fmt.Println(version.Short()) } else { - fmt.Println(version.Full()) + fmt.Print(version.Full()) } os.Exit(0) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/debian/rules new/fortio-1.32.0/debian/rules --- old/fortio-1.31.0/debian/rules 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/debian/rules 2022-05-22 06:41:43.000000000 +0200 @@ -4,7 +4,7 @@ #export DEB_BUILD_OPTIONS=--no-parallel # debian build farms don't have internet access so some of our grpc tests against -# fortio.istio.io can't work, so disabling tests by default +# grpc.fortio.org can't work, so disabling tests by default ifndef FORTIO_SKIP_TESTS export FORTIO_SKIP_TESTS=Y @@ -12,4 +12,3 @@ %: dh $@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/fgrpc/grpcrunner_test.go new/fortio-1.32.0/fgrpc/grpcrunner_test.go --- old/fortio-1.31.0/fgrpc/grpcrunner_test.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/fgrpc/grpcrunner_test.go 2022-05-22 06:41:43.000000000 +0200 @@ -88,7 +88,6 @@ }, expect: false, }, - /* re-enable once we have a replacement / we have demo.fortio.org running https { name: "valid secure runner using nil credentials to Internet https server", runnerOpts: GRPCRunnerOptions{ @@ -99,33 +98,25 @@ { name: "valid secure runner using nil credentials to Internet https server, default https port, trailing slash", runnerOpts: GRPCRunnerOptions{ - Destination: "https://fortio.istio.io/", + Destination: "https://grpc.fortio.org/", }, expect: true, }, { name: "invalid secure runner to insecure server", runnerOpts: GRPCRunnerOptions{ - Destination: "fortio.istio.io:443", + Destination: "grpc.fortio.org:443", }, expect: false, }, { name: "invalid secure runner using test cert to https prefix Internet server", runnerOpts: GRPCRunnerOptions{ - Destination: "https://fortio.istio.io:443", - CACert: caCrt, - }, - expect: false, - }, - { - name: "invalid secure runner using test cert to no prefix Internet server", - runnerOpts: GRPCRunnerOptions{ - Destination: "fortio.istio.io:443", + Destination: "https://grpc.fortio.org:443", + TLSOptions: fhttp.TLSOptions{CACert: caCrt}, }, expect: false, }, - */ { name: "invalid name in secure runner cert", runnerOpts: GRPCRunnerOptions{ @@ -265,28 +256,26 @@ CertOverride: "invalidName", }, }, - /* re-enable once we get replacement { name: "valid runner using nil credentials to Internet https server", runnerOpts: GRPCRunnerOptions{ - Destination: "https://fortio.istio.io/", + Destination: "https://grpc.fortio.org/", }, }, { name: "invalid runner using test cert to https prefix Internet server", runnerOpts: GRPCRunnerOptions{ - Destination: "https://fortio.istio.io/", - CACert: caCrt, + Destination: "https://grpc.fortio.org/", + TLSOptions: fhttp.TLSOptions{CACert: caCrt}, }, }, { name: "invalid runner using test cert to no prefix Internet server", runnerOpts: GRPCRunnerOptions{ - Destination: "fortio.istio.io:443", - CACert: caCrt, + Destination: "grpc.fortio.org:443", + TLSOptions: fhttp.TLSOptions{CACert: caCrt}, }, }, - */ } for _, test := range tests { test.runnerOpts.Service = "svc2" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/fgrpc/pingsrv_test.go new/fortio-1.32.0/fgrpc/pingsrv_test.go --- old/fortio-1.31.0/fgrpc/pingsrv_test.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/fgrpc/pingsrv_test.go 2022-05-22 06:41:43.000000000 +0200 @@ -22,6 +22,7 @@ "time" "fortio.org/fortio/fhttp" + "fortio.org/fortio/fnet" "fortio.org/fortio/log" "google.golang.org/grpc/credentials" "google.golang.org/grpc/health/grpc_health_v1" @@ -31,11 +32,13 @@ log.SetLogLevel(log.Debug) } +//nolint: gocognit func TestPingServer(t *testing.T) { TLSSecure := &fhttp.TLSOptions{CACert: caCrt, Insecure: false} TLSSecureMissingCert := &fhttp.TLSOptions{Insecure: false} TLSSecureBadCert := &fhttp.TLSOptions{CACert: failCrt, Insecure: true} TLSInsecure := &fhttp.TLSOptions{Insecure: true} + TLSInternet := &fhttp.TLSOptions{} iPort := PingServerTCP("0", "", "", "foo", 0) iAddr := fmt.Sprintf("localhost:%d", iPort) t.Logf("insecure grpc ping server running, will connect to %s", iAddr) @@ -47,12 +50,10 @@ if err != nil || latency < delay.Seconds() || latency > 10.*delay.Seconds() { t.Errorf("Unexpected result %f, %v with ping calls and delay of %v", latency, err, delay) } - /* re-enable once we get https://demo.fortio.org/ - if latency, err := PingClientCall(fnet.PrefixHTTPS+"fortio.istio.io:443", "", 7, - "test payload", 0); err != nil || latency <= 0 { + if latency, err := PingClientCall(fnet.PrefixHTTPS+"grpc.fortio.org:443", 7, + "test payload", 0, TLSInternet); err != nil || latency <= 0 { t.Errorf("Unexpected result %f, %v with ping calls", latency, err) } - */ if latency, err := PingClientCall(sAddr, 7, "test payload", 0, TLSSecure); err != nil || latency <= 0 { t.Errorf("Unexpected result %f, %v with ping calls", latency, err) } @@ -78,11 +79,9 @@ if r, err := GrpcHealthCheck(sAddr, "", 1, TLSSecure); err != nil || (*r)[serving] != 1 { t.Errorf("Unexpected result %+v, %v with empty service health check", r, err) } - /* re-enable once we get https://demo.fortio.org/ - if r, err := GrpcHealthCheck(fnet.PrefixHTTPS+"fortio.istio.io:443", "", "", 1); err != nil || (*r)[serving] != 1 { + if r, err := GrpcHealthCheck(fnet.PrefixHTTPS+"grpc.fortio.org:443", "", 1, TLSInternet); err != nil || (*r)[serving] != 1 { t.Errorf("Unexpected result %+v, %v with empty service health check", r, err) } - */ if r, err := GrpcHealthCheck(iAddr, "foo", 3, TLSInsecure); err != nil || (*r)[serving] != 3 { t.Errorf("Unexpected result %+v, %v with health check for same service as started (foo)", r, err) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/fhttp/http_server.go new/fortio-1.32.0/fhttp/http_server.go --- old/fortio-1.31.0/fhttp/http_server.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/fhttp/http_server.go 2022-05-22 06:41:43.000000000 +0200 @@ -502,14 +502,16 @@ // LogRequest logs the incoming request, including headers when loglevel is verbose. func LogRequest(r *http.Request, msg string) { - log.Infof("%s: %v %v %v %v (%s) %s %q", msg, r.Method, r.URL, r.Proto, r.RemoteAddr, - r.Header.Get("X-Forwarded-Proto"), r.Header.Get("X-Forwarded-For"), r.Header.Get("User-Agent")) + if log.Log(log.Info) { + log.Printf("%s: %v %v %v %v (%s) %s %q", msg, r.Method, r.URL, r.Proto, r.RemoteAddr, + r.Header.Get("X-Forwarded-Proto"), r.Header.Get("X-Forwarded-For"), r.Header.Get("User-Agent")) + } if log.LogVerbose() { // Host is removed from headers map and put separately - log.LogVf("Header Host: %v", r.Host) + log.Printf("Header Host: %v", r.Host) for name, headers := range r.Header { for _, h := range headers { - log.LogVf("Header %v: %v\n", name, h) + log.Printf("Header %v: %v\n", name, h) } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/fnet/network.go new/fortio-1.32.0/fnet/network.go --- old/fortio-1.31.0/fnet/network.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/fnet/network.go 2022-05-22 06:41:43.000000000 +0200 @@ -148,7 +148,7 @@ } lAddr := listener.Addr() if len(name) > 0 { - fmt.Printf("Fortio %s %s server listening on %s %s\n", version.Short(), name, sockType, lAddr) + log.Printf("Fortio %s %s server listening on %s %s\n", version.Short(), name, sockType, lAddr) } return listener, lAddr } @@ -167,7 +167,7 @@ return nil, nil } if len(name) > 0 { - fmt.Printf("Fortio %s %s server listening on udp %s\n", version.Short(), name, udpconn.LocalAddr()) + log.Printf("Fortio %s %s server listening on udp %s\n", version.Short(), name, udpconn.LocalAddr()) } return udpconn, udpconn.LocalAddr() } @@ -328,6 +328,23 @@ dnsMutex.Unlock() } +// checkCache will return true if it found and unlocked, keep the lock otherwise. +// port is only for logging. +func checkCache(host, port string) (found bool, res net.IP) { + dnsMutex.Lock() // unlock before IOs + if host != dnsHost { + // keep the lock locked + return + } + found = true + idx := dnsRoundRobin % uint32(len(dnsAddrs)) + dnsRoundRobin++ + res = dnsAddrs[idx] + dnsMutex.Unlock() // unlock before IOs + log.LogVf("Resolved %s:%s to cached #%d addr %+v", host, port, idx, res) + return +} + // ResolveByProto returns the address of the host,port suitable for net.Dial. // nil in case of errors. works for both "tcp" and "udp" proto. // Limit which address type is returned using `resolve-ip` ip4/ip6/ip (for both, default). @@ -355,14 +372,10 @@ filter := FlagResolveIPType.Get() dnsMethod := FlagResolveMethod.Get() idx := uint32(0) + inCache := false if dnsMethod == "cached-rr" { - dnsMutex.Lock() - if host == dnsHost { - idx = dnsRoundRobin % uint32(len(dnsAddrs)) - dnsRoundRobin++ - dest.IP = dnsAddrs[idx] - dnsMutex.Unlock() // unlock before IOs - log.LogVf("Resolved %s:%s to cached #%d addr %+v", host, port, idx, dest) + inCache, dest.IP = checkCache(host, port) + if inCache { return dest, nil } dnsMutex.Unlock() @@ -376,8 +389,12 @@ if l > 1 { switch dnsMethod { case "cached-rr": - // already covered the cache hit case above, so this is a miss/first set - dnsMutex.Lock() + // (re)check if we're the first to grab this lock (other threads may be here as well) + inCache, dest.IP = checkCache(host, port) + if inCache { + return dest, nil + } + // first time, first thread reaching here: dnsHost = host dnsAddrs = addrs idx = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/fnet/network_test.go new/fortio-1.32.0/fnet/network_test.go --- old/fortio-1.31.0/fnet/network_test.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/fnet/network_test.go 2022-05-22 06:41:43.000000000 +0200 @@ -23,6 +23,7 @@ "net" "os" "strings" + "sync" "testing" "time" @@ -552,6 +553,23 @@ fnet.FlagResolveIPType.Set("ip4") } +func TestDNSCacheConcurrency(t *testing.T) { + // Test isn't actually testing unless you use the debugger but coverage shows the extra if + // does happen. + fnet.FlagResolveIPType.Set("ip") + var wg sync.WaitGroup + n := 20 + wg.Add(n) + for i := 0; i < n; i++ { + go func() { + fnet.Resolve("localhost", "80") + wg.Done() + }() + } + wg.Wait() + fnet.FlagResolveIPType.Set("ip4") +} + func TestBadValueForDNSMethod(t *testing.T) { err := fnet.FlagResolveMethod.Set("foo") if err == nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/log/logger.go new/fortio-1.32.0/log/logger.go --- old/fortio-1.31.0/log/logger.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/log/logger.go 2022-05-22 06:41:43.000000000 +0200 @@ -53,7 +53,8 @@ // SetFlagDefaultsForClientTools changes the default value of -logprefix and -logcaller // to make output without caller and prefix, a default more suitable for command line tools (like dnsping). -// Needs to be called before flag.Parse(). +// Needs to be called before flag.Parse(). Caller could also use log.Printf instead of changing this +// if not wanting to use levels. func SetFlagDefaultsForClientTools() { lcf := flag.Lookup("logcaller") lcf.DefValue = "false" @@ -191,6 +192,11 @@ } } +// Printf forwards to the underlying go logger to print (with only timestamp prefixing). +func Printf(format string, rest ...interface{}) { + log.Printf(format, rest...) +} + // SetOutput sets the output to a different writer (forwards to system logger). func SetOutput(w io.Writer) { log.SetOutput(w) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/log/logger_test.go new/fortio-1.32.0/log/logger_test.go --- old/fortio-1.31.0/log/logger_test.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/log/logger_test.go 2022-05-22 06:41:43.000000000 +0200 @@ -107,6 +107,8 @@ expected += "I Log level is now 5 Critical (was 0 Debug)\n" Critf("testing crit %d", i) // should show expected += "C testing crit 7\n" + Printf("Printf should always show n=%d", 8) + expected += "Printf should always show n=8\n" _ = w.Flush() actual := b.String() if actual != expected { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortio-1.31.0/ui/uihandler.go new/fortio-1.32.0/ui/uihandler.go --- old/fortio-1.31.0/ui/uihandler.go 2022-05-20 04:13:35.000000000 +0200 +++ new/fortio-1.32.0/ui/uihandler.go 2022-05-22 06:41:43.000000000 +0200 @@ -700,20 +700,24 @@ flusher.Flush() o := fhttp.NewHTTPOptions(uStr) fhttp.OnBehalfOf(o, r) + // Increase timeout: + o.HTTPReqTimeOut = 5 * time.Second // If we had hundreds of thousands of entry we should stream, parallelize (connection pool) // and not do multiple passes over the same data, but for small tsv this is fine. - // use std client to change the url and handle https: + // use std client to avoid chunked raw we can get with fast client: client, _ := fhttp.NewStdClient(o) if client == nil { _, _ = w.Write([]byte("invalid url!<script>setPB(1,1)</script></body></html>\n")) - // too late to write headers + // too late to write headers for real case but we do it anyway for the Sync() startup case + w.WriteHeader(http.StatusServiceUnavailable) return } code, data, _ := client.Fetch() defer client.Close() if code != http.StatusOK { _, _ = w.Write([]byte(fmt.Sprintf("http error, code %d<script>setPB(1,1)</script></body></html>\n", code))) - // too late to write headers + // too late to write headers for real case but we do it anyway for the Sync() startup case + w.WriteHeader(code) return } sdata := strings.TrimSpace(string(data)) @@ -962,16 +966,16 @@ datadir = dataDir } } - fmt.Println("Data directory is", datadir) + log.Printf("Data directory is %s", datadir) } urlHostPort = fnet.NormalizeHostPort(port, addr) - uiMsg := "UI started - visit:\n" + uiMsg := "\t UI started - visit:\n\t " if strings.Contains(urlHostPort, "-unix-socket=") { uiMsg += fmt.Sprintf("fortio curl %s http://localhost%s", urlHostPort, uiPath) } else { uiMsg += fmt.Sprintf("http://%s%s", urlHostPort, uiPath) if strings.Contains(urlHostPort, "localhost") { - uiMsg += "\n(or any host/ip reachable on this server)" + uiMsg += "\n\t (or any host/ip reachable on this server)" } } fmt.Println(uiMsg) ++++++ vendor.tar.gz ++++++