Consider spawning the drop code instead of using
@alice Thanks for the suggestion. The drop code must be run to completion before moving on to the next drop. Additionally spawning means I no longer wait for the code to run (the runtime is being torn down), I never see the results of the cleanup if I do this. I'd wait on the JoinHandle returned from the spawn if I could, but drop is not in an asynchronous context, so I can't await the JoinHandle (it impls Future).
I would make sure you test it against the master branch of tokio. A number of issues have been filed there concerning panics during shutdown. You might also want to go over these issues.
block_on from the futures library will actually run a different scheduler than the tokio one to run your future.
Another thing I would do is to carefully check the order in which everything get's dropped.
If all else fails, make the simplest self contained example that illustrates the issue and post that so others can reproduce the issue to look into it.
I updated the SO question with the solution that I found. Thanks!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.