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

console_linux: Fix race: lock Cond before Signal. #27

Merged
merged 1 commit into from
Jul 5, 2018
Merged

console_linux: Fix race: lock Cond before Signal. #27

merged 1 commit into from
Jul 5, 2018

Commits on Jul 3, 2018

  1. console_linux: Fix race: lock Cond before Signal.

    Possible race:
    
    Thread1:			Thread2:
    line 178: Read() -> EAGAIN	...
    <reschedule>			line 110: EpollWait()
    ...				line 124: signalRead()
    ...				...
    line 191: Wait()		...
    				line 110: EpollWait()
    
    Thread2 (epoll) sends signalRead() (via sync.Cond) but Thread1 is not waiting
    yet. Then it starts to wait, but no more signals will arrive (because Thread2
    is sleeping in EpollWait() on edge-triggered epoll.
    
    To prevent this race one should held Lock when sending signalRead().
    
    The same situation goes with Write loop.
    
    Bug was reported to docker: docker/for-linux#353
    
    Signed-off-by: Alexander Gerasiov <gerasiov@yandex-team.ru>
    gerasiov committed Jul 3, 2018
    Configuration menu
    Copy the full SHA
    5d1b48d View commit details
    Browse the repository at this point in the history