[Solved] Actix dropping futures mpsc channel receiver


Hi. I am currently in the process of writing an application that utilizes Actix. I have a futures::mpsc channel that I use to communicate with another thread, and I’d like to have an Actix actor handle the receiver side of it.

I have registered the receiver as a stream with the actor using add_stream and provided a corresponding StreamHandler implementation and everything compiles, but when I actually try to send messages on the channel the send-call errors with the message “send failed because receiver is gone”. This appears to indicate that the receiver is dropped somewhere, but I don’t see where that would happen.

I’m quite new to Rust and non-single-threaded programming, so I apologize if I made a general error here, but I really can’t see it.



I found my problem, and as expected it was a basic oversight. I was stopping the entire system too quickly, so by the time the message was being sent the receiver had indeed already been dropped.