Skip to content

Fix nil pointer during SearchAttribute translation#102

Merged
pglass merged 3 commits intoscaleai/patchfrom
pglass/fix-nil
Jun 25, 2025
Merged

Fix nil pointer during SearchAttribute translation#102
pglass merged 3 commits intoscaleai/patchfrom
pglass/fix-nil

Conversation

@pglass
Copy link
Copy Markdown
Contributor

@pglass pglass commented Jun 24, 2025

What was changed

Avoid a nil pointer during search attribute translation.

This wasn't caught by existing tests because the visit library we use for reflection maintains a seen set based on pointer addresses. If a type contains two fields that are both pointer types, and both fields are nil, then it will only visit the first nil field. The next time it encounters a nil field, nil is already marked as a seen address and it skips that field without visiting it.

Why?

Checklist

  1. Closes

  2. How was this tested:

  • New unit tests
  1. Any docs updates needed?

@pglass pglass requested a review from a team as a code owner June 24, 2025 23:35
Copy link
Copy Markdown
Collaborator

@hehaifengcn hehaifengcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can just check it into main branch

containsObj: false,
makeType: func(name string) any {
return &persistence.WorkflowExecutionInfo{
SearchAttributes: nil,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious how the translation work in this case.

Copy link
Copy Markdown
Contributor Author

@pglass pglass Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we see SearchAttributes = nil, we should just ignore it. (It would mean this wf has no custom search attributes, so no translation needed)

@pglass pglass changed the title Add nil tests for SearchAttribute translation Fix nil pointer during SearchAttribute translation Jun 25, 2025
@pglass pglass merged commit 8081044 into scaleai/patch Jun 25, 2025
3 checks passed
@pglass pglass deleted the pglass/fix-nil branch June 25, 2025 16:19
temporal-nick pushed a commit that referenced this pull request Jun 25, 2025
* Fix nil pointer during SearchAttribute translation (#102)

* Continue clientLoop even client failed to dial with retry and add more logs (#103)

* Add more logging and enable debug

* disable debug log

* dial fail log

* Continue clientLoop even client failed to dial with retry

---------

Co-authored-by: Paul Glass <pnglass@gmail.com>
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