Skip to content

Socket starvation issue #89

@justxuewei

Description

@justxuewei

In the tsi_accept function, we must release the lock before tsi_accept_inet or tsi_accept_vsock. Otherwise, starvation might occur.

For example, in a thread, call accept() to block and wait for a connection to arrive. At this time, the lock of sock is acquired by the tsi_accept method. Then, in another thread, we are trying to call any syscall, e.g. shutdown(). If no connection comes, the shutdown() never gets a chance to acquire the lock.

I believe that, apart from tsi_accept(), all functions that call another function which might block the operation share this issue.

void tsi_accept() {
    lock_sock(sk);
    // omitted
    release_sock(sk);
    // a possible function to block the operation
    tsi_accept_inet();
    lock_sock(sk);
    // omitted
    release_sock(sk);
}

@slp Please take a look at this issue. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions