Commit Graph

538 Commits

Author SHA1 Message Date
David Reiss
80097936bd C++/TFramedTransport: Don't write an empty frame on flush.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665681 13f79535-47bb-0310-9956-ffa450edef68
2008-05-09 07:14:10 +00:00
David Reiss
4771458432 Fix a small logic error in TBufferedTransport::borrowSlow.
Was using an unsigned int for a value that could be negative.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665680 13f79535-47bb-0310-9956-ffa450edef68
2008-05-09 00:40:26 +00:00
David Reiss
f233e46a2d Throw a transport exception if fstat fails.
This was failing on an NFS mount that was dying.
Better to fail hard then return uninitialized data.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665677 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 06:21:04 +00:00
David Reiss
28f298dd5d Memory-based transport rewrite.
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
2008-05-01 06:17:36 +00:00
David Reiss
e39e937911 Remove a few unnecessary includes to speed up compiles.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665673 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 05:52:48 +00:00
David Reiss
6412000143 C++: Make write{Struct,Field}Begin take "name" as a const char*.
Summary:
These methods previously took name as a const string&.  While that way
is more idiomatic, it requires a temporary string to be constructed
when we pass a string literal (which is always).  This was significantly
slowing down the serialization of field-heavy structures.  This change
will break ABI compatibility, but the serialization speed boost with
no external API changes is too important to pass up.

Reviewed By: mcslee, aditya

Test Plan: make check

TracCamp Project: Thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665672 13f79535-47bb-0310-9956-ffa450edef68
2008-04-29 23:12:24 +00:00
David Reiss
c17fe6b918 THRIFT: Nonblcoking bug fix
calling decrement with -1 even though param is an integer. Just made it clean by adding a decrement function

reviewed by: mcslee
revertable
test plan: ran on a test server


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665669 13f79535-47bb-0310-9956-ffa450edef68
2008-04-29 00:29:43 +00:00
David Reiss
1997f10e28 Persistent conns in TSocketPool
Summary: Added support for persistent conns in TSocketPool
         Also, added some util functions in TNonblockingServer

Reviewed By: mcslee

Test Plan: Ran a test search cluster with these changes - open was only called once (I put fprintfs in open and close), after which the socket was reused

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 11425


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665668 13f79535-47bb-0310-9956-ffa450edef68
2008-04-29 00:29:41 +00:00
David Reiss
bd3b168e63 Silence a valgrind complaint by matching "delete[]" with "new[]".
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665666 13f79535-47bb-0310-9956-ffa450edef68
2008-04-28 02:42:28 +00:00
David Reiss
c8abb0733f Add build.xml, src, and LICENSE to EXTRA_DIST in lib/java/Makefile.am.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665664 13f79535-47bb-0310-9956-ffa450edef68
2008-04-21 18:08:01 +00:00
David Reiss
94058454a0 Add TBase64Utils.h and TJSONProto.h to lib/cpp/Makefile.am.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665663 13f79535-47bb-0310-9956-ffa450edef68
2008-04-21 18:07:58 +00:00
David Reiss
13c4380347 Add a distdir rule to lib/erl/Makefile to make "make check" happy.
This is a gross hack because lib/erl isn't using automake,
but it is still in SUBDIRs.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665661 13f79535-47bb-0310-9956-ffa450edef68
2008-04-21 18:07:49 +00:00
David Reiss
2724c7a311 Thrift: bug fix for interrupting server socket
Summary: TServerSocket uses a socket pair to signal interruption to the select() call on its main server socket.  A bug in the code prevented the select() from listening for events on the internal socket pair; in fact, it was accidentally listening to file descriptor 1.

Reviewed By: aditya

Test Plan: Use a server that supports a call to shutdown, which should signal an interrupt to the internal socket, and should result in an immediate and clean termination of the server socket thread.

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 11932


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665658 13f79535-47bb-0310-9956-ffa450edef68
2008-04-18 17:48:03 +00:00
David Reiss
739cbe2b86 Add a few missing includes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665657 13f79535-47bb-0310-9956-ffa450edef68
2008-04-15 05:44:00 +00:00
David Reiss
a177109752 Fix Thrift.cpp for non-Linux systems.
- Add some missing namespace qualifiers that are not used in the glibc case.
- Move an include from Thrift.h to Thrift.cpp.
- Include boost/lexical_cast.hpp in TJSONProtocol, in case we ever eliminate
  it from our header files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665656 13f79535-47bb-0310-9956-ffa450edef68
2008-04-11 22:36:31 +00:00
David Reiss
1d106ae6f0 Add simple "check" and "distclean" targets to lib/erl/Makefile.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665655 13f79535-47bb-0310-9956-ffa450edef68
2008-04-11 22:00:06 +00:00
dweatherford
e4dc4f5366 [thrift] Propogate exceptions from transports in thrift_protocol extension
Summary: Otherwise, it will spin forever if your socket connection gets dropped
  or otherwise times out.
Reviewed by: dbraginsky
Test plan: Modified TSocket to always throw an exception on read() and tried
  some service calls
Revert: svn


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665652 13f79535-47bb-0310-9956-ffa450edef68
2008-04-11 02:51:44 +00:00
David Reiss
b54deb1ca5 Fix a minor bug in TDebugProtocol and remove dead code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665650 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 19:38:49 +00:00
David Reiss
1677ac9cc7 Use poll instead of select in TServerSocket
Summary: - select has a restricted max fd set size. While this should not be an issue in the normal case for
           TServerSocket because it is started when the process starts, it could be a problem if someone wanted
           to start a new server socket at a later point in time when socket values could be greater than max.

Reviewed By: dreiss

Test Plan: - Compiled.
           - Deployed search tier and made sure it could serve queries.

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 11076


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665649 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 06:26:27 +00:00
David Reiss
9b20955b2d Thrift error logging improvements
Summary: - Move strerror_s to Thrift.h (was previously in TTransportException.h)
         - Capture errno as soon as syscall returns failure and make it part of error message.
         - Cleaned up several instances of the wrong error value being printed.
         - More consistently pass the errno in the TTransport Exception
         - Add more consistent error logging for the various transport failure modes

Reviewed By: dreiss

Test Plan: - compile everything.
           - test on search tier

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 11077


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665648 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 06:26:05 +00:00
David Reiss
22b1886dc7 use poll instead of select in TSocket
Summary: fd_set, which we pass into select only supports  fds with values < 1024.
         fds can be >= 1024.
         this can cause memory corruption

         learning this stuff over 2 weeks of examining crazy core dumps is way more fun that reading it up somewhere.

         poll takes an array of fds insetad, so your fd can be any int

Reviewed By: dreiss

Test Plan: ran inside a test search cluster

Revert: OK

DiffCamp Revision: 10731


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665647 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 06:25:45 +00:00
David Reiss
1ffb61beaa Fix a bug in TPipedTransport that broke pipelining.
Previously, TPipedTransport wrote it's full buffer to the "pipe" and
fully reset its buffer on a readEnd.  This assumed that the buffer was
fully read at that point.  This is not the case if requests are pipelined.
This change makes it only pipe out the portion that has been read and
copy the unread portion to the beginning of the buffer.

Also add a test that verifies the new functionality.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665646 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 05:07:26 +00:00
David Reiss
e4db03d110 Add TFDTransport: a dead-simple wrapper around a file-descriptor.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665644 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 05:06:59 +00:00
David Reiss
e0e3d1b232 Add TProtocolTap: a meta-protocol for "wiretapping".
TProtocolTap is a protocol that passes reads through to a "source" protocol,
but mirrors them as writes to a "sink" protocol.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665643 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 05:06:45 +00:00
David Reiss
642f2d3fbe TDebugProtocol: Add support for messages.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665642 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 05:06:32 +00:00
David Reiss
a80f0fb47a TDebugProtocol: Support a limit on string length.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665641 13f79535-47bb-0310-9956-ffa450edef68
2008-04-08 05:06:15 +00:00
David Reiss
1dd17f5a53 Update OCamlMakefile to the latest version and include its README.
Updating isn't really necessary, I just wanted to be 100% that I had
the right version of the README for the version of the Makefile we had.
The main reason for including the README is to make the license clear.

Reviewed By: iproctor


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665637 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 20:16:45 +00:00
David Reiss
04c6267aba Squelch most Java 1.6 warnings.
I actualy wasn't able to test this with Java 1.5.
Hopefully it doesn't break anything.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665636 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 20:16:28 +00:00
David Reiss
c631e98cad Moved the java libraries from src to src/com/facebook/thrift.
Apparently this is what all the Java kids are doing these days.
Ran ant in lib/java and it built fine.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665635 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 20:16:10 +00:00
David Reiss
cee1e085b5 C#: Catch exceptions by name.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665631 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 22:10:09 +00:00
David Reiss
437c03bb3d C#: Make TSimpleServer a public class.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665630 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 22:10:06 +00:00
David Reiss
d8217422c8 C#: Fix a bug in the TApplicationException reader.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665629 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 22:09:43 +00:00
David Reiss
cfb23bb8db C# Makefile: New versions of Mono don't require -langversion:linq.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665628 13f79535-47bb-0310-9956-ffa450edef68
2008-04-02 22:09:03 +00:00
David Reiss
58b4fa7e26 Fix a memory leak in TBinaryProtocol.
Summary:
realloc doesn't free the original pointer when it returns null.

Reviewed By: cpiro

Test Plan: make check

TracCamp Project: Thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665626 13f79535-47bb-0310-9956-ffa450edef68
2008-04-01 04:17:58 +00:00
David Reiss
7502e0be13 Fix a bug with Perl's TSocket and THttpClient.
The underlying Perl library expects timeouts in seconds, but the
documentation for the Thrift classes says the should be in milliseconds.
This changes divides timeouts by 1000 to make that the case.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665585 13f79535-47bb-0310-9956-ffa450edef68
2008-03-27 19:45:24 +00:00
dweatherford
0b8a382c00 [thrift] Error checking for T_OBJECT serialization
Summary: Avoid segfaulting via calling zend_fetch_class_entry on something
  that might not actually be an object; throw an exception instead.
Reviewed by: shire


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665581 13f79535-47bb-0310-9956-ffa450edef68
2008-03-25 03:15:10 +00:00
Christopher Piro
9cc63b53ef [thrift] add setTcp{Send,Recv}Buffer to C++ TSocketServer
Summary: needs moar BDPs

Reviewed By: mcslee

Test Plan: now using in our service

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665579 13f79535-47bb-0310-9956-ffa450edef68
2008-03-21 00:40:42 +00:00
David Reiss
d92ca7dcea Prevent Java's TProtocolUtil.skip from overflowing the stack.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665577 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 19:32:00 +00:00
David Reiss
fc78b23633 Make the C# build task more robust.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665576 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:22:52 +00:00
David Reiss
c9d06ee2dd Fixes for the C# library.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665575 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:22:43 +00:00
David Reiss
8f3bce4153 TSocketPool changes
Summary: 1] Added empty constructor
         2] Added function to set server list
         3] Made getServers return by ref
         4] Made list of servers be a list of pointers

         The last change is so that someone can pass in the list of servers and rely on TSocketPool to change the failure time directly on the TSocketServer object

Reviewed By: aditya

Test Plan: Ran with a test search server

Revert: OK

DiffCamp Revision: 9529


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665571 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 18:21:52 +00:00
dweatherford
840ca085fc [thrift] php thrift_protocol crash fixes
Summary: The convert_to_*_ex functions were being used improperly resulting
  in heap corruption in some cases; I just switched everything over to the
  non-ex versions since it shouldn't matter if I modify the value being
  serialized in place to coerce it to the proper type.

  Also fixed a potential crash for map, set, and list types when not passed
  an array, by first attempting an array conversion and then throwing a
  tprotocolexception if that doesn't succeed. (Actually, PHP might fatal there
  instead, it wasn't immediately clear from reading the code if that would
  be the case).

Reviewed by: marcel
Test plan: Ran under php-5.2.5, debug and release builds. No more heap corruption
  or memory leak complaints (the latter also a side effect of undesired zval
  reference separation).
Revert: only if you love SIGSEGV


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665566 13f79535-47bb-0310-9956-ffa450edef68
2008-03-08 05:51:24 +00:00
David Reiss
84e63abf2e Remove some trailing whitespace.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665564 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:28 +00:00
David Reiss
ea5e75af3b Add Java JSON protocol implementation.
Implement full-featured JSON protocol, low-level base-64 encode/decode
methods, and related tests.

Conflicts (resolved by dreiss):

	test/java/build.xml


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665562 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:20 +00:00
David Reiss
a7f879b81f Add Java memory buffer transport implementation.
Wraps a TByteArrayOutputStream.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665561 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:17 +00:00
David Reiss
80f6398b63 Add NOT_IMPLEMENTED exception code.
Preparation for Java JSON protocol implementation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665560 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:13 +00:00
dweatherford
9b945da3ca [thrift] ZTS fixes for thift_protocol extension
Summary: Now the threadsafe build compiles!
Reviewed by: mcslee
Test Plan: compiles, ship it
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665558 13f79535-47bb-0310-9956-ffa450edef68
2008-03-06 03:11:08 +00:00
lucas
f8f21e769e restore tags/1.0.0, we need these at least until fb9 is rolled everywhere
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665557 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 22:04:13 +00:00
David Reiss
a79e48874b TNonblockingServer: Fix wrong exception names
Reviewed By: dreiss

Test Plan: trivial :)

Revert: OK

DiffCamp Revision: 8789


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665556 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 07:51:47 +00:00
David Reiss
edde04804b Thrift: Add writePtr(), wroteBytes() to TMemoryBuffer
Summary: This adds the discussed interface to TMemoryBuffer, as follows:

         - writePtr(size) returns a ptr you can write (size) bytes to
         - wroteBytes() lets it know you wrote that many bytes

         To do this, I refactored an:
         - ensureCanWrite(size) private func

Reviewed By: dreiss

Test Plan: works in my test environment

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 8739


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665555 13f79535-47bb-0310-9956-ffa450edef68
2008-03-05 07:51:44 +00:00