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

Why is it safe for old rust_port.cpp to store a pointer to its owning task? #2874

Closed
bblum opened this issue Jul 11, 2012 · 4 comments
Closed
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@bblum
Copy link
Contributor

bblum commented Jul 11, 2012

rust_kernel has a facility for looking up a port by id and returning it refcounted so the port doesn't go away. But what stops the task from going away, making port->task invalid to somebody attempting to send on a channel associated with that port?

@bblum
Copy link
Contributor Author

bblum commented Jul 11, 2012

Likely related to #1923.

@ghost ghost assigned eholk Jul 11, 2012
@brson
Copy link
Contributor

brson commented Jul 11, 2012

Destroying a port involves 'detaching' it, after which there are supposed to be no references to it and it's not accessible via the kernel's port table, and a task can't die without destroying its ports.

There's an assert in rust_port::end_detach that checks that the port is not referenced. I have seen that assert fail in the past, though not recently.

@bblum
Copy link
Contributor Author

bblum commented Jul 11, 2012

@eholk should close this when #2851 closes.

@bblum
Copy link
Contributor Author

bblum commented Jul 12, 2012

Ah, I see now. It looks good to me.

@bblum bblum closed this as completed Jul 12, 2012
jaisnan added a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
This regression test ensures that issue rust-lang#2874 does not reoccur, which
was last encountered in commit 9190831.

Resolves rust-lang#2874

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Jacob Salzberg <salzber@amazon.com>
Co-authored-by: Jaisurya Nanduri <91620234+jaisnan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

3 participants