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

Command doesn't exit if thread is stuck in blocking I/O #109

Closed
jethrogb opened this issue Mar 7, 2019 · 3 comments
Closed

Command doesn't exit if thread is stuck in blocking I/O #109

jethrogb opened this issue Mar 7, 2019 · 3 comments
Labels
bug C-enclave-runner Crate: enclave-runner

Comments

@jethrogb
Copy link
Member

jethrogb commented Mar 7, 2019

This program may not terminate:

use std::{net::TcpListener, sync::mpsc, thread};

fn main() {
    let (tx, rx) = mpsc::channel();
    thread::spawn(move || {
        let listen = TcpListener::bind("0:0").unwrap();
        tx.send(()).unwrap();
        while let Ok(_) = listen.accept() {}
    });
    rx.recv().unwrap();
    println!("Exiting main thread");
}

This is because when the main thread exits, the second thread is likely to be blocking in an accept() call. Therefore, that thread never terminates and the main thread (out of the enclave) is waiting indefinitely for that second thread to finish.

@jethrogb jethrogb added bug C-enclave-runner Crate: enclave-runner labels Mar 7, 2019
@jethrogb
Copy link
Member Author

jethrogb commented Mar 7, 2019

I expect this to be fixed alongside #18.

mzohreva added a commit that referenced this issue Mar 19, 2020
mzohreva added a commit that referenced this issue Mar 23, 2020
mzohreva added a commit that referenced this issue Mar 23, 2020
mzohreva added a commit that referenced this issue Mar 25, 2020
bors bot added a commit that referenced this issue Mar 27, 2020
223: Enable enclave exit when a TCS is blocked on I/O r=jethrogb a=mzohreva

This fixes issue #109

Co-authored-by: Mohsen Zohrevandi <mohsen.zohrevandi@fortanix.com>
mzohreva added a commit to mzohreva/rust that referenced this issue Apr 23, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 28, 2020
Process termination test for SGX

The issue is described in fortanix/rust-sgx#109

cc @jethrogb
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 28, 2020
Process termination test for SGX

The issue is described in fortanix/rust-sgx#109

cc @jethrogb
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 1, 2020
Process termination test for SGX

The issue is described in fortanix/rust-sgx#109

cc @jethrogb
bors added a commit to rust-lang-ci/rust that referenced this issue May 13, 2020
Process termination test for SGX

The issue is described in fortanix/rust-sgx#109

cc @jethrogb
@jethrogb
Copy link
Member Author

Closing since #18 is merged. Ok, @mzohreva ?

@mzohreva
Copy link
Contributor

Yeah, this was fixed in #223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug C-enclave-runner Crate: enclave-runner
Projects
None yet
Development

No branches or pull requests

2 participants