Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple CI and code fixes #486

Merged
merged 6 commits into from
Dec 9, 2019
Merged

Multiple CI and code fixes #486

merged 6 commits into from
Dec 9, 2019

Conversation

paskal
Copy link
Collaborator

@paskal paskal commented Dec 9, 2019

  • enable golangci-lint run for memory_store example
  • fix detected errors in memory_store:
accessor/data.go:409:3  ineffassign  ineffectual assignment to `meta`
accessor/data.go:419:3  ineffassign  ineffectual assignment to `meta`
  • fix runaway goroutine in TestRest_Shutdown
  • add race_test option to Makefile
  • fix multiple typos across the code

@paskal
Copy link
Collaborator Author

paskal commented Dec 9, 2019

Yet uncaught (file operations?) data race

To reproduce, run cd backend/app and then go test -race -mod=vendor -timeout=60s -count 1 ./...

Discovered after fixing runaway goroutine in TestRest_Shutdown, as it was shadowing this problem.

I've tried to fix it by adding finished channel closing and waiting to Test_Main but it didn't resolve the problem and I didn't commit that change.

==================
WARNING: DATA RACE
Write at 0x0000026558a0 by goroutine 163:
  github.com/umputun/remark/backend/app/rest/api.startupT()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/lgr/interface.go:44 +0x10b
  github.com/umputun/remark/backend/app/rest/api.TestRest_Ping()
      /Users/dmitry/Documents/remark/backend/app/rest/api/rest_public_test.go:26 +0x50
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:909 +0x199

Previous read at 0x0000026558a0 by goroutine 221:
  github.com/umputun/remark/backend/app/store/image.(*FileSystem).Commit()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/lgr/interface.go:28 +0x94
  github.com/umputun/remark/backend/app/store/image.(*Service).Submit.func1.1()
      /Users/dmitry/Documents/remark/backend/app/store/image/image.go:77 +0x214

Goroutine 163 (running) created at:
  testing.(*T).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:960 +0x651
  testing.runTests.func1()
      /usr/local/opt/go/libexec/src/testing/testing.go:1202 +0xa6
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:909 +0x199
  testing.runTests()
      /usr/local/opt/go/libexec/src/testing/testing.go:1200 +0x521
  testing.(*M).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:1117 +0x2ff
  main.main()
      _testmain.go:214 +0x223

Goroutine 221 (running) created at:
  github.com/umputun/remark/backend/app/store/image.(*Service).Submit.func1()
      /Users/dmitry/Documents/remark/backend/app/store/image/image.go:69 +0x113
  sync.(*Once).doSlow()
      /usr/local/opt/go/libexec/src/sync/once.go:66 +0x100
  sync.(*Once).Do()
      /usr/local/opt/go/libexec/src/sync/once.go:57 +0x68
  github.com/umputun/remark/backend/app/store/image.(*Service).Submit()
      /Users/dmitry/Documents/remark/backend/app/store/image/image.go:65 +0x81
  github.com/umputun/remark/backend/app/store/service.(*DataStore).submitImages()
      /Users/dmitry/Documents/remark/backend/app/store/service/service.go:165 +0x143
  github.com/umputun/remark/backend/app/store/service.(*DataStore).Create()
      /Users/dmitry/Documents/remark/backend/app/store/service/service.go:105 +0x1c2
  github.com/umputun/remark/backend/app/rest/api.(*private).createCommentCtrl()
      /Users/dmitry/Documents/remark/backend/app/rest/api/rest_private.go:92 +0xc7a
  github.com/umputun/remark/backend/app/rest/api.(*private).createCommentCtrl-fm()
      /Users/dmitry/Documents/remark/backend/app/rest/api/rest_private.go:54 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-pkgz/rest/logger.(*Middleware).Handler.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/rest/logger/logger.go:123 +0x297
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi/middleware.NoCache.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/middleware/nocache.go:54 +0x39a
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/umputun/remark/backend/app/rest/api.matchSiteID.func1()
      /Users/dmitry/Documents/remark/backend/app/rest/api/rest.go:542 +0x2ed
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-pkgz/auth/middleware.(*Authenticator).auth.func2.1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/auth/middleware/auth.go:79 +0xadd
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/didip/tollbooth_chi.(*limiterWrapper).ServeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/didip/tollbooth_chi/tollbooth_chi.go:41 +0x46c
  github.com/go-chi/chi/middleware.Timeout.func1.1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/middleware/timeout.go:45 +0x2e4
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi.(*ChainHandler).ServeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/chain.go:31 +0x73
  github.com/go-chi/chi.(*Mux).routeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:425 +0x3e4
  github.com/go-chi/chi.(*Mux).routeHTTP-fm()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:399 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi.(*Mux).ServeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:70 +0xa0b
  github.com/go-chi/chi.(*Mux).Mount.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:292 +0x1fc
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi.(*Mux).routeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:425 +0x3e4
  github.com/go-chi/chi.(*Mux).routeHTTP-fm()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:399 +0x5f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/cors.(*Cors).Handler.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/cors/cors.go:199 +0x20f
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-pkgz/rest.Ping.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/rest/middleware.go:39 +0x2a4
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-pkgz/rest.AppInfo.func1.1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/rest/middleware.go:22 +0x45b
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-pkgz/rest.Recoverer.func1.1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-pkgz/rest/middleware.go:55 +0xee
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi/middleware.RealIP.func1()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/middleware/realip.go:34 +0x99
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2007 +0x51
  github.com/go-chi/chi/middleware.(*throttler).ServeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/middleware/throttle.go:94 +0x4cc
  github.com/go-chi/chi.(*Mux).ServeHTTP()
      /Users/dmitry/Documents/remark/backend/vendor/github.com/go-chi/chi/mux.go:82 +0x642
  net/http.serverHandler.ServeHTTP()
      /usr/local/opt/go/libexec/src/net/http/server.go:2802 +0xce
  net/http.(*conn).serve()
      /usr/local/opt/go/libexec/src/net/http/server.go:1890 +0x837
==================

@umputun umputun merged commit 30c42ce into umputun:master Dec 9, 2019
@paskal paskal deleted the ci_fixes branch December 9, 2019 19:15
@paskal paskal added this to the v1.5 milestone Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants