Skip to content

ThreadExecutorMap must restore old EventExecutor (#14895)#14899

Merged
normanmaurer merged 2 commits into
4.1from
41_thread_executor_map
Mar 7, 2025
Merged

ThreadExecutorMap must restore old EventExecutor (#14895)#14899
normanmaurer merged 2 commits into
4.1from
41_thread_executor_map

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

ThreadExecutorMap did just set the stored EventExecutor to null once done in its wrapping methods. This is not correct as this might result in losing the current EventExecutor. Beside this the same problem existed in ManualIoEventLoop.

Modifications:

  • Add FastThreadLocal.getAndSet(...) that return the old stored value
  • Keep track of the old value in ThreadExecutorMap / ManualIoEventLoop and restore it
  • Add unit test

Result:

Correctly restore old value

Motivation:

ThreadExecutorMap did just set the stored EventExecutor to null once
done in its wrapping methods. This is not correct as this might result
in losing the current EventExecutor. Beside this the same problem
existed in ManualIoEventLoop.

Modifications:

 - Add FastThreadLocal.getAndSet(...) that return the old stored value
- Keep track of the old value in ThreadExecutorMap / ManualIoEventLoop
and restore it
- Add unit test

Result:

Correctly restore old value

---------

Co-authored-by: Chris Vest <christianvest_hansen@apple.com>
@normanmaurer normanmaurer added this to the 4.1.120.Final milestone Mar 7, 2025
@normanmaurer normanmaurer merged commit 1a59152 into 4.1 Mar 7, 2025
@normanmaurer normanmaurer deleted the 41_thread_executor_map branch March 7, 2025 10:05
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.

1 participant