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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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