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

Add timeout support #31

Open
jethrogb opened this issue Nov 20, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@jethrogb
Copy link
Member

commented Nov 20, 2018

The following operations in std require some form of timeout support:

  • TcpStream::connect_timeout
  • TcpStream::set_read_timeout
  • TcpStream::set_write_timeout
  • thread::sleep
  • thread::sleep_ms
  • thread::park_timeout
  • thread::park_timeout_ms
  • Condvar::wait_timeout
  • mpsc::Receiver::recv_timeout

Currently, the first just doesn't use a timeout, and the rest errors/panics.

The ABI currently does not support waiting a specified amount (only no wait or indefinite wait): https://docs.rs/fortanix-sgx-abi/0.1.0-rc1/fortanix_sgx_abi/struct.Usercalls.html#method.wait . It's also not clear if timeouts make sense in SGX setting, in particular: is it the case that users depend on accurate timeouts for security purposes?

@jethrogb

This comment has been minimized.

Copy link
Member Author

commented Dec 7, 2018

sleep, park, and Condvar can be fixed by allowing more values for the timeout parameter to the wait usercall.

More work is needed to support read/write/connect. Here are some ideas:

Option 1

Add a way to cancel async usercalls, then do the async call in conjunction with wait with timeout. If wait returns first, cancel the async call.

Concern: atomicity

Option 2

Add *const Usercall/*mut Return to wait(), to specify timeout for a specific call.

Concern: Is this a reasonable API? How does this behavior interact with event_mask and allowed spurious wakeups?

Option 3

Add timeout() usercall, very similar to “Option 2”, except that there is a dedicated API.

Concern: API size increase.

@jethrogb

This comment has been minimized.

Copy link
Member Author

commented Apr 1, 2019

Should the API use deadlines or timeouts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.