Comments (4)
Hi, there're 2 problems with your setup.
-
gunicorn_thrift should be started with
gunicorn_thrift app:processor -k thriftpy_gevent --thrift-protocol-factory thriftpy.protocol:TBinaryProtocolFactory --thrift-transport-factory thriftpy.transport:TBufferedTransportFactory --error-log -
please notice
-k thriftpy_gevent
rather than-k thrift_gevent
-
service name not the same with thrift file. This might not be a problem, but out of some concerns, you should keep them the same.
processor.register_processor("PingPong", app1) processor.register_processor("Hello", app2)
from gunicorn_thrift.
我使用了thriftpy_gevent代替了thrift_gevent,解决了上述的问题,但是当客户端和服务器端通信时,服务器端能返回正确的数据,但是也会出现异常,如下:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/Library/Python/2.7/site-packages/gunicorn_thrift/thriftpy_gevent_worker.py", line 88, in handle
itrans.close()
File "thriftpy/transport/buffered/cybuffered.pyx", line 38, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.close (thriftpy/transport/buffered/cybuffered.c:1358)
File "/Library/Python/2.7/site-packages/thriftpy/transport/socket.py", line 29, in close
self.handle.shutdown(socket.SHUT_RDWR)
File "/Library/Python/2.7/site-packages/gevent/socket.py", line 517, in shutdown
self._sock.shutdown(how)
error: [Errno 57] Socket is not connected
<Greenlet at 0x107703730: <functools.partial object at 0x107780f70>(<socket at 0x1077b03d0 fileno=11 sock=127.0.0.1:80, ('127.0.0.1', 49525))> failed with error
客户端使用的是java,代码如下:
public static void main(String[] args) {
try {
TTransport tTransport = new TSocket("127.0.0.1", 8000);
tTransport.open();
TProtocol protocol = new TBinaryProtocol(tTransport);
TMultiplexedProtocol hello = new TMultiplexedProtocol(protocol, "hello");
Hello.Client client = new Hello.Client(hello);
String response = client.hello2015();
System.out.println(response);
tTransport.close();
} catch (Exception e) {
e.printStackTrace();
}
}
能否帮忙分析一下哪里的代码出现了问题
启动方式
gunicorn_thrift app:processor -k thriftpy_gevent --thrift-protocol-factory thriftpy.protocol:TBinaryProtocolFactory --thrift-transport-factory thriftpy.transport:TBufferedTransportFactory --error-log -
from gunicorn_thrift.
尝试升级一下 thriftpy 的版本吧.
from gunicorn_thrift.
解决了,谢谢。
from gunicorn_thrift.
Related Issues (20)
- Is it right always log a full stack exception? HOT 3
- Gevent support in Python 3 HOT 2
- Problem about running gunicorn_thrift HOT 3
- gunicorn_thrift block problem with high concurrency HOT 5
- Implement gthread worker HOT 1
- The gunicorn got timeout but not exit HOT 1
- Could not open eleme/gunicorn any more HOT 3
- Update pypi distribution HOT 2
- in the pressure test,cpu usage suddenly fall for a moment,it leads to that requests were time out HOT 2
- when i use gunicorn_thrift to start thriftpy2 app, one worker just can accept one client connection HOT 1
- gunicorn + thriftpy2 使用上的几点疑问 HOT 12
- 关于SO_REUSEPORT的问题 HOT 9
- 线上偶现请求时间过长问题 HOT 2
- Issue of gunicorn version HOT 3
- Configure worker number HOT 2
- Is this repo alive? HOT 11
- gunicorn_thrift with http query HOT 3
- 没有及时回收socket HOT 4
- [gunicorn compatibility issue] ImportError: cannot import name 'six' from 'gunicorn' HOT 2
- can I set not default proto_factory to handle the request?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gunicorn_thrift.