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

Thrift serialization errors for nil/empty map value #4603

Open
vytautas-karpavicius opened this issue Oct 26, 2021 · 1 comment
Open

Thrift serialization errors for nil/empty map value #4603

vytautas-karpavicius opened this issue Oct 26, 2021 · 1 comment
Assignees
Labels

Comments

@vytautas-karpavicius
Copy link
Contributor

Version of Cadence server, and client(which language)

  • Server version: tested on 0.21, 0.22 & latest master
  • Client version: 0.18.3 (with and without grpc)
  • Client langauge: go
  • DB: tested on Cassandra and MySQL

Describe the bug
Setting a header (via context propagator) or a memo when starting a workflow with a nil (or empty) value in map results in errors similar to this:

"Uncategorized error","service":"cadence-frontend","error":"cadence serialization error: failed to write field 10 (TList): failed to write field 340 (TStruct): failed to write field 140 (TStruct): failed to write field 10 (TMap): invalid [key]: value is nil"

To Reproduce
Start a workflow with:

Memo: map[string]interface{}{
			"key": []byte(nil),
		},

Expected behavior
No errors

Additional context
This may (or may not) be related to internal type conversions between thrift <-> internal <-> proto. There are already few cases for special nil/empty value handling. It is possible something else is missing.

@vytautas-karpavicius vytautas-karpavicius self-assigned this Oct 26, 2021
@vytautas-karpavicius
Copy link
Contributor Author

So there are actually two different issues:

  1. When setting empty []byte on workflow header via context propagator. The error only happens when using gRPC. And it was already fixed with Fix proto mapper for Payload #4184 and was included in v0.21.3 and later.
  2. Setting empty value []byte on workflow memo. This is not yet fixed and happens on Cassandra only. It is represented as map<text, blob>. Both nil and empty []byte are stored as memo: {'key': 0x} which when deserialized becomes nil. It in turn does not work with Thrift encoder that we still use for sending data to visibility store. It spits out an error to the logs. Also such workflow then has a corrupted visibility record. It is unable to view it via WebUI.

@ibarrajo ibarrajo added the bug label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants