fix: bind InternalRPC and heartbeat tasks to the provided runtime#454
Open
PopClom wants to merge 3 commits intoamqp-rs:mainfrom
Open
fix: bind InternalRPC and heartbeat tasks to the provided runtime#454PopClom wants to merge 3 commits intoamqp-rs:mainfrom
PopClom wants to merge 3 commits intoamqp-rs:mainfrom
Conversation
Collaborator
|
Nice catch, thanks! I'd rather keep the internal_rpc start where it is though and not add more not-really-related things to the io loop. Could you drop the move to io_loop; keep your test and bump the dependency of async-rs to 0.8.2 to confirm everything is ok this way? |
Author
|
Makes sense, thanks! Bumped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
connect_uri_with_runtimeaccepts an explicit runtime, butInternalRPC::runand the heartbeat task are spawned viaasync_rs'sruntime.spawn(), which checksHandle::try_current()before the stored handle. Since the runtime is typically constructed viatokio_current()— which captures a Handle but does not hold an ownedTokioRT—self.runtimeis None, andtry_current()always wins when called from an async context, ignoring the handle that was explicitly provided.When the caller's runtime has a shorter lifetime than the connection — e.g. a
#[tokio::test]runtime sharing a connection pool across tests —InternalRPC::rundies when the test ends, silently breaking publish confirmations.Fix: bump
async-rsto 0.8.2, which checks the stored handle beforeHandle::try_current().