Skip to content

Infinite hang when channel incompletely read #144

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

Closed
jyasskin opened this issue Aug 10, 2010 · 2 comments
Closed

Infinite hang when channel incompletely read #144

jyasskin opened this issue Aug 10, 2010 · 2 comments

Comments

@jyasskin
Copy link
Contributor

The following program hangs forever in trying to destroy the to_child chan, because it's waiting for the queue to be emptied by the child, which has completed and will never do so.

io fn incomplete_read(chan[chan[str]] for_incoming_chan) {
  let port[str] incoming = port();
  for_incoming_chan <| chan(incoming);
  auto read_one <- incoming;
  // Never read the second string.
}

io fn main() {
  let port[chan[str]] get_to_child = port();
  auto child = spawn incomplete_read(chan(get_to_child));
  let chan[str] to_child <- get_to_child;
  to_child <| "str 1";
  to_child <| "never read";
}
@froystig
Copy link
Contributor

Somewhat relevant: a similar race is commented about (and worked-around) in test/run-pass/obj-dtor.rs.

@graydon
Copy link
Contributor

graydon commented Jan 27, 2011

Fixed long ago. Now completes with:

rt: warning: '_unread == 0', at: rt/circular_buffer.cpp:29 freeing circular_buffer with 4 unread bytes

oli-obk pushed a commit to oli-obk/rust that referenced this issue Jul 19, 2017
move all code accessing vtable internals into the `trait` module
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
kazcw pushed a commit to kazcw/rust that referenced this issue Oct 23, 2018
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Oct 26, 2020
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 1, 2021
* Add x86 vendor conversions
* Add wasm32 vendor types
* Add arm vendor types
* Add powerpc vendor types
celinval pushed a commit to celinval/rust-dev that referenced this issue Nov 20, 2024
…t-lang#144)

# Description 
This PR introduces function contracts and proof harness for the NonNull
pointer in the Rust core library. Specifically, it verifies three new
APIs—`swap`, `replace`, and `drop_in_place` with Kani. These changes
enhance the functionality of memory operations for NonNull pointers.

# Change Overview
Covered APIs:
1. NonNull::swap: Swaps the values at two mutable locations of the same
type
2. NonNull::replace: Replaces the pointer's value, returning the old
value
3. NonNull::drop_in_place: Executes the destructor (if any) of the
pointed-to value

Resolves rust-lang#53 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
This issue was closed.
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