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

Changes to Client/Server #165

Merged
merged 7 commits into from
Feb 24, 2020
Merged

Changes to Client/Server #165

merged 7 commits into from
Feb 24, 2020

Conversation

asppsa
Copy link
Collaborator

@asppsa asppsa commented Sep 4, 2019

  • Server is rewritten to use a fiber per connection. This makes handling stateful stuff like iterating over an enumerator easier.
  • Server also uses _nonblock methods to hopefully speed up IO
  • each_key is implemented on the Server/Client
  • Client now buffers reads if it doesn't manage to read the whole server response at once.

@asppsa asppsa changed the title Changes the Client/Server Changes to Client/Server Sep 6, 2019
@asppsa asppsa force-pushed the server-fibers branch 4 times, most recently from 4c28d41 to b597fd8 Compare September 8, 2019 15:07
@asppsa
Copy link
Collaborator Author

asppsa commented Oct 6, 2019

This is hanging in JRuby because Thread.current does not remain the same across fibers on that platform.

This makes each connection on the server into a fiber that has its own
state.  In theory this should allow for easier implementation of things
like `each_key` over the server.
This method returns true when the wrapper is running in server mode
This version has some threading fixes that we need.
@brutuscat
Copy link
Contributor

@asppsa that’s how the Thread.current “hash” works. Each fiber gets its own scoped storage. Instead maybe you should try thread_variable_set & thread_variable_get? See https://ruby-doc.org/core-2.4.1/Thread.html

@asppsa
Copy link
Collaborator Author

asppsa commented Feb 23, 2020

@brutuscat, the issue was resolved in JRuby 9.2.9.0 - jruby/jruby#5863

I think this PR actually works fine now - there's an issue with actionpack on Ruby 2.2, dropping 2.2 support will resolve that.

@asppsa asppsa merged commit 301196b into master Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants