Mysterious drop of Receiver

I'm having trouble debugging a mysterious (to me, at least) drop of a future::oneshot::channel::Receiver. I've noticed because the corresponding sender would error out upon sending, and it seems to me the Receiver is dropped at a point I did not expect.

I've stepped through with gdb, and got stuck on this line. When reaching this line, something weird is happening: GDB doesn't ever enter the match statement when stepping through, even in cases where everything's ok. Did I miss something, shouldn't those lines show up in gdb as well?

Now the problem I'm having happens in specific circumstances (a certain test, where the first time this function is called everything works out, and the second time I encounter this error), and the way I see it is this: The referenced line awaits for the sender to send something, so as far as I can tell the receiver should never drop before receiving something, right? Yet in the error case, the Sender fails to send, and I've verified from the debug printout that the Inners complete is true at that point indeed.

So, sorry if this is somewhat confusing, I'm trying to get a grip on what's happening. Is there a good way to really ascertain that the receiver dropping is the problem? The channel connects to futures, so cause and effect are a tad hard to separate.

Thanks for any pointers :slight_smile:

(Without doing so myself.) You should be looking at what happens to the Future that call returns. i.e. is it getting dropped somewhere.

Breakpoints can be hit and miss sometimes in regular code, (never mind async.) It's just a case of something mismatching between the source line and equivalent is machine code; rather than something such as the code not existing / ever getting called.

Any specific advice on how to do that, some println I could insert or so? I mean, I know where it's called (and what's up the callchain as well), but of course I might be missing something.

I remember seeing a lot of ptr::real_drop_in_place in the stacktraces of gdb, and weirdly something pointing to line 46 of the test (which isn't a function at all), so you're either right that the source lines are off, or maybe there's really something wrong with my understanding :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.