Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour with multiple channels caused by illegal pattern-bindings #4718

Closed
14427 opened this issue Feb 1, 2013 · 5 comments
Closed

Comments

@14427
Copy link
Contributor

14427 commented Feb 1, 2013

I would expect the following code: https://gist.github.com/4688550

to print (Left | Right): Some(0|1|2) in an infinite loop.

It only prints Some(0) and Some(2).

Removing the right channels causes Some(0), Some(1) and Some(2) to all be printed as expected.

Getting rid of the try_recv() on the right port doesn't get rid of the problem.

@14427
Copy link
Contributor Author

14427 commented Feb 1, 2013

I'm not sure if it helps, but this is on the master branch from the end of December. It doesn't look like there have been any big changes to pipes since then.

@14427
Copy link
Contributor Author

14427 commented Feb 1, 2013

The crashing thing seems to have just been from using try_recv() on an empty channel, so it's just the fact that Some(1) isn't getting printed that's weird.

@14427
Copy link
Contributor Author

14427 commented Feb 2, 2013

Also, it only seems to affect spawn, spawn_sched works fine. Makes me think that fixing #4419 should fix this too.

@brson
Copy link
Contributor

brson commented Mar 9, 2013

This code is unsound because the spawn closures are making incorrect copies of the ports and channels as in #4679. Mapping those pairs from &(Port, Chan) to Port looks buggy too. Neither Port nor Chan are copyable types, so they must be moved around (or shared and cloned with SharedChan). I expect this not to compile on incoming, but I am interested in whether or not an adapted version continues to exhibit problems.

@bblum
Copy link
Contributor

bblum commented Jul 3, 2013

I believe the &-patterns are a known soundness hole that allow copying noncopyables. Removing the infinite loop at the end causes the vector, which has illegal copies of the ports/chans in it, to double-destruct them. #3235 will make this illegal; closing.

@bblum bblum closed this as completed Jul 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants