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

[servers/console] Fix reentrancy issues #124

Merged
merged 1 commit into from
Oct 11, 2018
Merged

Conversation

perlun
Copy link
Contributor

@perlun perlun commented Oct 11, 2018

There were a few:

  • The handle_connection method would save away the mailbox IDs for
    its connection to the video server (VGA), for later use. It would then
    sit and block on receive on the input mailbox from it, effectively
    blocking other threads from using it. A typical reentrancy bug.
  • The code for opening up new consoles would call video_mode_set(),
    using the above data structure, but if multiple consoles were being
    opened simultaneously (which happen now since we run servers in parallel
    at boot), the same thing could happen - multiple threads tried to use a
    single connection to the VGA server, which works very poorly. I added a
    poor man's semaphore to work around this.

There were a few:

- The `handle_connection` method would save away the mailbox IDs for
its connection to the video server (VGA), for later use. It would then
sit and _block on receive_ on the input mailbox from it, effectively
blocking other threads from using it. A typical reentrancy bug.
- The code for opening up new consoles would call `video_mode_set()`,
using the above data structure, but if multiple consoles were being
opened simultaneously (which happen now since we run servers in parallel
at boot), the same thing could happen - multiple threads tried to use a
single connection to the VGA server, which works very poorly. I added a
poor man's semaphore to work around this.
@perlun perlun self-assigned this Oct 11, 2018
@perlun perlun added the bug label Oct 11, 2018
@perlun perlun merged commit b2e6e1a into master Oct 11, 2018
@perlun perlun deleted the fix/reentrancy-issues branch October 11, 2018 21:53
@perlun perlun mentioned this pull request Oct 13, 2018
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant