Page MenuHomePhabricator

Structured data message unmarshaling randomly fails
Closed, ResolvedPublic5 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • spin up structured-data service locally
  • make sure that the service is fully running
  • run make mock command to publish mock messages to the service

What happens?:
Service fails with a panic. Here's a trace:

github.com/hamba/avro/v2.walkSchema({0x1121660?, 0xc00321e510?}, 0xc00293db58)
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_walk.go:9 +0x24d
articleupdate-1  | github.com/hamba/avro/v2.walkSchema({0x11216a0?, 0xc004fa8230?}, 0xc00293db58)
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_walk.go:17 +0x1b0
articleupdate-1  | github.com/hamba/avro/v2.walkSchema({0x1121620?, 0xc0069501a0?}, 0xc00293db58)
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_walk.go:9 +0x25f
articleupdate-1  | github.com/hamba/avro/v2.derefSchema({0x1121620, 0xc0069501a0})
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_parse.go:558 +0xbf
articleupdate-1  | github.com/hamba/avro/v2.ParseBytesWithCache({0xc002bf4140, 0x12b, 0x140}, {0x0, 0x0}, 0xc00293dd38?)
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_parse.go:75 +0x192
articleupdate-1  | github.com/hamba/avro/v2.ParseBytes(...)
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_parse.go:60
articleupdate-1  | github.com/hamba/avro/v2.Parse({0xc002bf4000?, 0x1120530?})
articleupdate-1  |      /go/pkg/mod/github.com/hamba/avro/v2@v2.20.1/schema_parse.go:20 +0x36
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/schema.(*Schema).Parse(...)
articleupdate-1  |      /app/submodules/schema/registry.go:82
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/schema.(*Helper).Sync(0xc000128000, {0x1120530, 0xc00003a018}, {0xf3adab, 0x1f}, 0x1677d40, {0xc002af3b60, 0x1, 0xc00293df08?})
articleupdate-1  |      /app/submodules/schema/helper.go:138 +0x505
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/schema.(*Helper).Sync(0xc000128000, {0x1120530, 0xc00003a018}, {0xf3adab, 0x1f}, 0x1678280, {0x0, 0x0, 0x8?})
articleupdate-1  |      /app/submodules/schema/helper.go:115 +0x350
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/schema.(*Helper).Marshal(0xc000128000, {0x1120530, 0xc00003a018}, {0xf3adab, 0x1f}, 0x1678280, {0xf0faa0, 0xc0058cc160})
articleupdate-1  |      /app/submodules/schema/helper.go:189 +0x19f
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/schema.(*Helper).Produce(0xc000128000, {0x1120530, 0xc00003a018}, {0xc003787920, 0x3, 0x6?})
articleupdate-1  |      /app/submodules/schema/helper.go:278 +0x1e5
articleupdate-1  | wikimedia-enterprise/services/structured-data/handlers/articleupdate/handler.NewArticleUpdate.func1({0x1120530, 0xc00003a018}, 0xc00014f340)
articleupdate-1  |      /app/handlers/articleupdate/handler/handler.go:374 +0x5e44
articleupdate-1  | wikimedia-enterprise/services/structured-data/submodules/subscriber.(*Subscriber).Subscribe.func1(0x0?)
articleupdate-1  |      /app/submodules/subscriber/subscriber.go:139 +0xd9
articleupdate-1  | created by wikimedia-enterprise/services/structured-data/submodules/subscriber.(*Subscriber).Subscribe
articleupdate-1  |      /app/submodules/subscriber/subscriber.go:135 +0x1fc

What should have happened instead?:
Service should successfully process mock events without failing.

To-Do(s)

  • fix the schema package to allow thread safe parsing
  • update structured-data service with the latest version of the package to fix the issue

Additionally

  • Create a GitHub issue for the hamba/avro package

Event Timeline

During my investigation I've found out that issue is happening when the service needs to concurrently parse multiple schemas.