tikv / yatp

Yet another thread pool in rust for both callbacks or futures.
Apache License 2.0
135 stars 32 forks source link

ban local spawns across pools #45

Closed sticnarf closed 4 years ago

sticnarf commented 4 years ago

Previously we utilize local spawn as long as the TLS handle LOCAL exists.

However, when a waker is called in a thread of a different yatp pool, the future can be transfered from one pool to another unexpectedly.

This PR checks whether the waker and the current local handle are of the same pool. If no, we spawn remotely.

sticnarf commented 4 years ago

PTAL @BusyJay cc @Little-Wallace

zhangjinpeng87 commented 4 years ago

Any issue can cause if not fixed?

sticnarf commented 4 years ago

Any issue can cause if not fixed?

Not any known issue in TiKV 4.0.

There would be problem if a future in pool A reads TLS specific to pool A and the future is notified in another yatp pool B.