Commit Graph

67 Commits

Author SHA1 Message Date
Kevin Clark
1e0744d7a2 rb: Make TServer.py Python 2.4 compatible [THRIFT-44]
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@671337 13f79535-47bb-0310-9956-ffa450edef68
2008-06-24 20:46:32 +00:00
David Reiss
b04df765b5 Change Python servers to use the standard logging module.
Previously Thrift was using `print` to report errors.  Thrift is infrastructure
and should not impose its error logging mechanism on the apps that use it.  For
example, [elided] uses the logging module to send logs to a particular file.

I ran the unit test.  That exercises most of the error handling routines.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666364 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:38 +00:00
David Reiss
bcaa2ad0d6 Python forking server should close connection in parent.
When a function called by the forking python thrift server throws an
exception the client will hang.  This happens because the parent of the
forked process does not properly close the socket fd.

Under normal operation the server operation completes and returns a value to
the client.  However, when an exception occurs the 'end' message is never
sent to the client so the client relies on a connection close to abort the
call (this is how the threading server works I believe).

This fails with the forking server because the parent process never closes
the socket fd.  The child has closed the fd at this point, but the
connection will not actually be closed until all open instances of the fd
are closed. Since the client is waiting for a message and the server never
closes it the client is forced to wait until a read timeout occurs many
minutes later.

This diff closes the parent's copy of the socket fd immediately after the
fork occurs.

I modified my load test server to throw an exception.  The client did not hang.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666363 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:26 +00:00
David Reiss
665365490f Forking Python server.
The python threading model does not provide concurrency for CPU-bound
processes.  Process forking is the current recommended way of writing
scalable Python servers.

Harry Wang ran the [elided] backend with this change for 3 days and observed
no errors.  The threaded backend caused unexplained lockups under this load
after 24 hours.

I also ran a CPU-bound load test against this server with 32 concurrent
clients.  It completed 5X faster than the threaded implementation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666359 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:54:49 +00:00
David Reiss
3de1c4e4d3 Use "all-local" instead of all in Makefile.am.
Summary:
Redefining an Automake rule totally blows away anything Automake puts in place.
By using all-local instead of all, we can just add to the generated rule.

Reviewed By: marc

Test Plan: make


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665499 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 17:45:03 +00:00
David Reiss
2ca456a8ae Make "make clean" rules a bit more standard.
Summary:
make-generic is some sort of internal undocumented thing.
make-local is what is supposed to be used for this stuff.
Also use $(RM) instead of "rm -f".

Reviewed By: marc

Test Plan: make clean


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665498 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 16:42:18 +00:00
David Reiss
223d6bd1ac Make "make check" work properly for Python and Java.
Summary:
The Python and Java versions of "make check" only work if "make all" has
been run.  Our automake-fu isn't strong enough to make proper dependencies,
so this hack suggested by Nitay will force the libraries to be built
before make check is run.

Test Plan: make check


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665497 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 02:03:17 +00:00
David Reiss
bc444b034e Thrift: Fix a bug in the skip function in Python's fastbinary.c
Reviewed By: mcslee

Other Notes:
Submitted by Ben Maurer (the original author).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665479 13f79535-47bb-0310-9956-ffa450edef68
2008-02-14 20:20:08 +00:00
David Reiss
0c90f6f8af Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.

Reviewed By: mcslee

Test Plan: git diff -b

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:18:40 +00:00
dweatherford
33d8f340dc [thrift] py: TApplicationException.__str__
Summary: Now infinitely more printable than ever before!
Reviewed by: mcslee
Test Plan: except TApplicationException, inst: \n\t\t print inst
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665414 13f79535-47bb-0310-9956-ffa450edef68
2008-01-07 22:23:07 +00:00
David Reiss
832b262aca Thrift: Revamp build to use a single configure.ac.
Summary:
Ben Maurer suggested that it would make sense for Thrift to build as
a single project, with one configure.ac and multiple Makefile.am.
He was also kind enough to do the heavy lifting, and this commit
is the application of his patch (with minor modifications).
The most significant visible change from this diff is that
in order to buidl one of the thrift sub-projects (i.e.: the compiler,
the C++ library, or the Python library) you must run bootstrap.sh
and configure in the Thrift root, then make in the specific project.
Users who want to build and install the Python library but
can't run configure because they don't have Boost can simply
run setup.py directly.

Reviewed By: mcslee

Test Plan: Built Thrift from scratch.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665409 13f79535-47bb-0310-9956-ffa450edef68
2007-12-28 18:25:33 +00:00
David Reiss
c16a8f6e45 Thrift: Python support for Unix-domain sockets, and eager timeout setting.
Reviewed By: mcslee

Test Plan: Ran the test script.

Revert Plan: ok

Other Notes:
Contributed by Ben Maurer.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665394 13f79535-47bb-0310-9956-ffa450edef68
2007-12-14 23:46:47 +00:00
Mark Slee
256bdc4448 IPv6 tweaks for Thrift
Summary: Need to pass hints including AI_ADDRCONFIG to getaddrinfo to make sure no IPv6 addresses come back on non-IPv6 enabled systems

Reviewed By: mcslee

Other Notes: Submitted by Paul Saab


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665368 13f79535-47bb-0310-9956-ffa450edef68
2007-11-27 08:42:19 +00:00
Mark Slee
53d9c0c20b Merging EOFException changes from Ben Maurer
Summary: Throw a proper EOFError in this case. Long term we want to change this to properly fit into the Thrift TException heirarchy with a good way to handle the original exception as well. For now, Ben is the primary user of this so we'll go ahead with his patch.

Reviewed By: mcslee

Test Plan: Included in test/py/TestEof.py


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665365 13f79535-47bb-0310-9956-ffa450edef68
2007-11-26 21:15:40 +00:00
dweatherford
65b7075b5a [thrift] Output dir selection + updated TSCons
Summary: Allows setting the output directory via the new '-o dir' cmdline option.

  TSCons is updated to use this to put the output in the right place no matter
  the cwd, so doing dependent builds from different directories won't break.

Reviewed By: martin
Test Plan: mkdir /tmp/honk; thrift -cpp -java -javabean -php -phpi -py -rb -xsd -perl -erl -ocaml -hs -cocoa -o /tmp/honk Tablet.thrift
Revert: svn


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665311 13f79535-47bb-0310-9956-ffa450edef68
2007-10-31 02:18:14 +00:00
Mark Slee
5299a959e0 Python automated test patch
Summary: Submitted by Ben Maurer

Reviewed By: dreiss

Test Plan: Automated python testing for Thrift, lovely.

Revert: OK

DiffCamp Revision: 737


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665293 13f79535-47bb-0310-9956-ffa450edef68
2007-10-05 00:13:24 +00:00
Mark Slee
9b36ef3575 Fix 32-bit Python encoding integer issue
Summary: Python on 32-bit platforms 2.4+ wants to keep hexconstants positive, therefore converting 0x800000000 to a (long) type to keep that. This causes issues when performing comparison with a signed negative integer.

Reviewed By: dreiss

Test Plan: Python on 32 bit 2.4+ system making Thrift calls


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665287 13f79535-47bb-0310-9956-ffa450edef68
2007-10-02 04:44:48 +00:00
David Reiss
b72d19f653 Thrift: Prep for release.
Summary:
- make dist is no fun.  Had to add a lot of stuff to Makefile.am to
  make sure stuff got included in the tarball.
- Added a permanent NEWS file with the release notes for this release.
- clean.sh removes ylwrap also.
- Gave it a real version for make dist.
- Added ACLOCAL_AMFLAGS to lib/cpp/Makefile.am to make it easier to
  work on configure.ac.
- Made concurrency_test a non-installed binary because
  no one wants to install it.
- Dropped some symlinks that were annoying make dist.
- Updated README.

Test Plan:
./bootstrap.sh && ./configure && make dist
Compared contents of tarball to source tree.
Did this from a fresh git tree so no gross untracked files would be around.
On devrs: ./bootstrap.sh && ./configure && make install DESTDIR=/tmp/relinst1
Made sure concurrency_test was built but not installed.
Checked zlib URL with firefox.

Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665274 13f79535-47bb-0310-9956-ffa450edef68
2007-09-18 19:46:00 +00:00
mvaradachari
476b796fd7 Updating TSCons.py to provide capability of passing additional flags to thrift besides the default flag --cpp. EX: scons_env(env,'--py --php')
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665266 13f79535-47bb-0310-9956-ffa450edef68
2007-09-17 20:40:16 +00:00
David Reiss
2c2e6d27a2 Thrift: Python TBufferedTransport improvements.
Summary:
The Python version of TBufferedTransport now uses input buffering.
It is also compatible with the fasbinary module.

Reviewed By: mcslee

Test Plan:
test/FastbinaryTest.py

dreiss@dreiss-vmware:~/gp/thrift/test/py$ strace -f ./TestClient.py 2>&1 | grep recv | wc -l
99
# Install new version in other terminal
dreiss@dreiss-vmware:~/gp/thrift/test/py$ strace -f ./TestClient.py 2>&1 | grep recv | wc -l
14

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665250 13f79535-47bb-0310-9956-ffa450edef68
2007-09-05 01:14:09 +00:00
David Reiss
d683219966 Thrift: Python installation.
Summary:
Added the configure script variable PY_PREFIX which serves the same purpose
for Python as --prefix does for C/C++.  We chose to do this because Python
has different conventions for where to install libraries.

Reviewed By: mcslee

Test Plan:
Full clean builds and installs of Thrift from the Thrift root,
with and without PY_PREFIX.  Watched output of make install.

Ran configure from lib/py without PY_PREFIX, with PY_PREFIX and with
PY_PREFIX in the environment.  Checked config.status for each.

Revert Plan: okay


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665248 13f79535-47bb-0310-9956-ffa450edef68
2007-09-05 00:47:32 +00:00
David Reiss
5db3e92671 Thrift: Handle absence of fastbinary.so
Summary:
- Wrap import of fastbinary in a try/catch, setting it to None if it fails.
- Don't try to fastbinary.encode/decode if fastbinary is None.
- Always generate thrift_spec, even if it is None.
- Don't try to fastbinary.encode/decode if thrift_spec is None.

Reviewed By: mcslee

Test Plan:
test/py/Test{Client,Server}.py
Manually delete my fastbinary.so, they worked fine.
Changed them to use Accelerated protocol.  They still worked fine because
the test falls through to the normal generated code.
Installed fastbinary.so, everything worked fine (eventually).

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665236 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 23:07:45 +00:00
David Reiss
792df0bf78 Thrift: Pre-generate reflection_limited for Python.
Summary:
- Give reflection_limited a nice clean Python module.
- if/regen.sh now generates reflection_limited for Python and copies it to src.
- Added the generated Python for reflection_limited to version control.
- lib/py/setup.py installs reflection_limited.
- lib/py/cleanup.sh now removes build (make sure to run as root).
- The C++ version of reflection_limited was also updated by regen.sh.

Reviewed By: mcslee

Test Plan:
- Clean build and install.
- Look at the installed Python files.
- python -c 'from thrift.reflection.limited.ttypes import *'

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665235 13f79535-47bb-0310-9956-ffa450edef68
2007-08-30 03:30:22 +00:00
David Reiss
aea19c9d65 Thrift: Python libraries install into /usr, not /usr/local
Summary:
It seems like the Python convention is that random janky libraries
are installed in /usr/lib/pythonX.Y/site-packages.  This patch follows
that convention, even though it is pretty gross to ignore --prefix.

Reviewed By: mcslee

Test Plan: make install thrift python libs on my box.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665233 13f79535-47bb-0310-9956-ffa450edef68
2007-08-29 23:17:32 +00:00
David Reiss
5ec8e26d25 Thrift: Fix fastbinary.c for Python 2.4.
Summary:
The recently committed fastbinary.c doesn't compile with Python 2.4.
This version does.

Blame Rev: 56816

Reviewed By: mcslee

Test Plan: make install on devrs004

Revert Plan: Do 56816 also.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665225 13f79535-47bb-0310-9956-ffa450edef68
2007-08-26 02:21:24 +00:00
David Reiss
382fc3043c Thrift: Native-code Binary Protocol encoder.
Summary:
Merging a patch from Ben Maurer.
This adds a python extension (i.e., a C module) that
encodes Python thrift structs into the standard binary protocol
much faster than our generated Python code.

Also added by-value equality comparison to thrift structs
(to help with testing).

Cleaned up some trailing whitespace too.

Reviewed By: mcslee, dreiss

Test Plan:
Recompiled Thrift.
Thrifted a bunch of IDLs and compared the generated Python output.
Looked at the extension module a lot.
test/FastBinaryTest.py

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665224 13f79535-47bb-0310-9956-ffa450edef68
2007-08-25 18:01:30 +00:00
Aditya Agarwal
99e2c07815 -- allow packaging of thrift as an rpm
Summary:
- also allows development as a non-root user
- contributed by Ben Maurer

Reviewed By: marc

Test Plan: "compile", install


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665185 13f79535-47bb-0310-9956-ffa450edef68
2007-07-31 01:36:08 +00:00
Aditya Agarwal
0dd0916f9a -- Adding TMemoryBuffer.py
Summary:
Submitted by Ben Maurer

Reviewed By: mcslee, aditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665184 13f79535-47bb-0310-9956-ffa450edef68
2007-07-30 23:58:37 +00:00
pfung
a46438e11d [Thrift] fixing python server socket bind permissions
Fix made by Paul Saab from powerset (ps@powerset.com)

reviewed by mcslee
test plan: tested


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665180 13f79535-47bb-0310-9956-ffa450edef68
2007-07-27 20:43:49 +00:00
Mark Slee
26549566bc Fix for IPv6 Python sockets binding localhost problem
Reviewed By: mcslee

Test Plan: Python Thrift server

Notes: From ps@powerset.com


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665179 13f79535-47bb-0310-9956-ffa450edef68
2007-07-27 18:56:56 +00:00
James Wang
e168d5e127 Summary: TSocket shouldn't let you set the timeout before it's got a valid handle
Reviewed By: dcorson

Test Plan: tested in sandbox


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665172 13f79535-47bb-0310-9956-ffa450edef68
2007-07-24 23:59:51 +00:00
Mark Slee
2297460253 Python IPv6 support for TSocket
Summary: Contributed by Paul Saab of Powerset

Reviewed By: mcslee

Test Plan: Python test stuff


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665153 13f79535-47bb-0310-9956-ffa450edef68
2007-07-06 22:20:19 +00:00
Mark Slee
552410c037 Idiotic typos in Python code
Summary: No clue how this slid in

Reviewed By: abosworth

Test Plan: I am stupid. TestClient.py


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665139 13f79535-47bb-0310-9956-ffa450edef68
2007-06-22 01:03:55 +00:00
Mark Slee
808454ec63 Thrift TBinaryProtocol change
Summary: New Thrift TBinaryProtocol with a version identifier

Reviewed By: aditya, eugene

Test Plan: Modify your services to have strictRead_ and strictWrite_ both set to FALSE. Then redeploy your services and test running clients against them. Once you have clients and servers running stably on this new code, you should redploy versions with strictWrite_ set to TRUE. Once that's all good, we can set strictRead_ to TRUE as well, and eventually deprecate the old protocol code entirely.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665138 13f79535-47bb-0310-9956-ffa450edef68
2007-06-20 21:51:57 +00:00
Mark Slee
7679196f1c Various Thrift fixes, including Application Exception support in Ruby, better errror messages across languages, etc.
Reviewed By: thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665058 13f79535-47bb-0310-9956-ffa450edef68
2007-03-14 02:47:35 +00:00
Mark Slee
b6616fc42d No such thing as e.message in python socket error?
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665052 13f79535-47bb-0310-9956-ffa450edef68
2007-03-07 05:46:05 +00:00
Mark Slee
54b7ab9b53 READMEs and DOCs and ant tasks, oh my
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665048 13f79535-47bb-0310-9956-ffa450edef68
2007-03-06 00:06:27 +00:00
Mark Slee
fb40c190ca Oops missed license on one python file
Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665035 13f79535-47bb-0310-9956-ffa450edef68
2007-03-01 00:35:54 +00:00
Mark Slee
89e2bb84e2 Applying Thrift software license to Python source
Reviewed By: python


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665032 13f79535-47bb-0310-9956-ffa450edef68
2007-03-01 00:20:36 +00:00
Mark Slee
57cc25e2a3 Some Thrift documentation cleanups
Summary: Getting ready to hand this over to powerset, just want to have the right licenses in place and such first.

Reviewed By: thrift


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665029 13f79535-47bb-0310-9956-ffa450edef68
2007-02-28 21:43:54 +00:00
Mark Slee
bd8b991fa7 Python HttpClient for Thrift
Reviewed By: thrifty goodness for SMC


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665026 13f79535-47bb-0310-9956-ffa450edef68
2007-02-27 20:17:00 +00:00
Mark Slee
e74306a965 Move constant defs into Thrift.py to avoid cirulcar includes
Reviewed By: snakes


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665016 13f79535-47bb-0310-9956-ffa450edef68
2007-02-21 05:38:12 +00:00
Mark Slee
92195ae219 Starting python exception handling cleanup
Reviewed By: aditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665013 13f79535-47bb-0310-9956-ffa450edef68
2007-02-21 05:16:30 +00:00
Mark Slee
0e5283914f Take out debug print in TServer constructor
Reviewed By: aditya

Test Plan: no print on construct


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665000 13f79535-47bb-0310-9956-ffa450edef68
2007-02-20 04:23:26 +00:00
Mark Slee
04342d8b63 another typo i missed
Summary: outut

Reviewed By: aditya

Test Plan: blog


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664999 13f79535-47bb-0310-9956-ffa450edef68
2007-02-20 03:41:35 +00:00
Mark Slee
fb84b2b264 Adityaslop typos in thrift py server
Summary: outut is not output

Reviewed By: aditya, cheever

Test Plan: blogfeeds fixin


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664998 13f79535-47bb-0310-9956-ffa450edef68
2007-02-20 03:37:28 +00:00
Aditya Agarwal
9bae5e783e -- typo in TSocket
Reviewed By: slee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664985 13f79535-47bb-0310-9956-ffa450edef68
2007-02-07 02:36:56 +00:00
Aditya Agarwal
f954f97b96 -- Allow specification of socket timeouts in thrift python socket code
Reviewed By: slee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664976 13f79535-47bb-0310-9956-ffa450edef68
2007-02-06 01:26:12 +00:00
Aditya Agarwal
5c468196dc -- Protocol and transport factories now wrap around a single protocol/transport
Summary:
- This is an analagous to the C++ change made in r31441

Reviewed By: cheever, mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664975 13f79535-47bb-0310-9956-ffa450edef68
2007-02-06 01:14:33 +00:00
Mark Slee
eb0d024ee1 Full automake/autoconf compliance for thrift
Summary: Including the compiler!!!

Reviewed By: automake


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664949 13f79535-47bb-0310-9956-ffa450edef68
2007-01-25 07:58:55 +00:00