You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2008/10/15 22:48:44 UTC
[jira] Commented: (THRIFT-171) Expected blocking from TSocket but
didn't get it
[ https://issues.apache.org/jira/browse/THRIFT-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639960#action_12639960 ]
Bryan Duxbury commented on THRIFT-171:
--------------------------------------
TSimpleServer is behaving as expected. TThreadedServer (or TNonblockingServer) would partially resolve the issue, but as you've noted, Rails is only safe with a single thread.
If want you want is fair server behavior but are willing to have Rails single-threadedness, then you should use one of the better servers and a mutex of your own in the handler implementation.
I'm not sure there's actually an issue here - should we close this invalid, and move any needed discussion to the mailing list?
> Expected blocking from TSocket but didn't get it
> ------------------------------------------------
>
> Key: THRIFT-171
> URL: https://issues.apache.org/jira/browse/THRIFT-171
> Project: Thrift
> Issue Type: Bug
> Components: Library (Java), Library (Ruby)
> Affects Versions: 0.1
> Environment: CentOS 4.x
> Reporter: Dave Dupre
>
> I have a Thrift server built in Ruby on Rails. It uses the TSimpleServer class since my server is using Rails to generate HTML (Rails view code expects to be single threaded). I have two clients: one in Java and one in Ruby. Here is what I see:
> Ruby client:
> # Usual init code straight from the tutorial here
> transport.open
> 1000.times { client.my_method }
> transport.close
> The Java client is basically the same. Unfortunately, I see two different behaviors when running multiple client instances. With a Ruby client, execute client A, and it starts processing normally. Execute client B while client A is still running, and it blocks at transport.open until client A completes. This is what I expected. However, if I do the same thing with Java clients, both clients proceed in parallel. Unfortunately, this gets the server very confused and into a really bad state. I'm using TSocket which should be doing blocking I/O, but that is not what I'm seeing happen.
> Is there some magic that I can do to make this work? Right now, I use configuration to ensure that only one Java client thread/process is allowed to talk to my Ruby server, but this is a total hack. Switching to TThreadedServer makes blocking go away, but I'm nervous about what that will mean to the Rails controller and view code. FYI, my server allows me to generate HTML views via Thrift. If it was a pure Ruby server, then I would not be concerned, but since so much is dependent on code that usually assumes to be single threaded, I'm concerned about introducing bugs.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.