This fixes a process and file descriptor leak -- previously, the thrift_buffered_transport process was linked to the acceptor, which never died.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666409 13f79535-47bb-0310-9956-ffa450edef68
- Exceptions don't work yet, but it looks like everything else does.
- Seems to work fine on our pricing service
- Code could need some cleanup
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666377 13f79535-47bb-0310-9956-ffa450edef68
On FreeBSD (and possibly other BSDs), binding to ipv6 is restricted unless the
sysctl net.inet6.ip6.v6only=0 or the socket option IPV6_V6ONLY is turned off.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666367 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Previously, if you set a structure field to, say, an int when it was
supposed to be a container (array) or struct (object), the serialization
code would either produce corrupt output (container) or cause a fatal
error (struct). Now they both throw exceptions.
Reviewed By: mcslee
Test Plan: Looked at generated code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666365 13f79535-47bb-0310-9956-ffa450edef68
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
Summary:
Add an argument to the Mutex constructor.
It takes a pointer to a function that initializes the internal pthread_mutex_t.
We provide initializers for default pthread_mutex_t (which is our default),
adaptive mutexes, and recursive mutexes.
Reviewed By: hzhao, psaab, mcslee
Test Plan: Built libthrift.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666362 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
Adds an #ifdef'd block that calls ProfilerRegisterThread() if
"REGISTER_THREAD_GOOGLE_PERFTOOLS" is set. Apparently, this makes the
Google perftools CPU profiler work much better on x86-64.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666358 13f79535-47bb-0310-9956-ffa450edef68
The Java Makefile.ams assume the existence of ANT, but "make distclean"
runs in the Java directories even if ENABLE_JAVA is off. This change
makes the clean-local target handle the absence of ANT, fixing
"make distclean".
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665683 13f79535-47bb-0310-9956-ffa450edef68
Specifically, switch from the legally-ambiguous RSA implementation to
a zlib-licensed RFC-based implementation from SourceForge.
Generated some files with "dense" and made sure the output hadn't changed.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665679 13f79535-47bb-0310-9956-ffa450edef68
The old implementations of the memory-based transports (TBufferedTransport,
TFramedTransport, and TMemoryBuffer) shared very little code and all worked
a bit differently. This change unifies them all as subclasses of a single
base (TBufferBase) which handles the fast-path operations (when requests
can be satisfied by the buffer) with inline methods (that will eventually
be made nonvirtual in the template branch) and calls out to pure-virutal
methods to handle full/empty buffers. All of the buffer-management is now
done in terms of "base and bound" pointers rather than "pos" integers.
These classes were moved to TBufferTransports.{h,cpp}. The .h is included
in TTransportUtils for backwards compatibility.
Also added a "TShortReadTransport" to assist testing transports.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665676 13f79535-47bb-0310-9956-ffa450edef68
Also throw an error in the compiler if we cannot generate a constant for a
declared const because of its type. Added a test of this functionality in
ConstantsDemo.thrift.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665675 13f79535-47bb-0310-9956-ffa450edef68