Commit Graph

1016 Commits

Author SHA1 Message Date
David Reiss
77f6f7f567 Add build/ dir for alterl bindings and remove them from .gitignore
Summary: These files are copied from the erl/build dir. I don't know why
         I accidentally gitignored them before.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666413 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:57:11 +00:00
David Reiss
abded23ed4 Implement testAsync for python tests
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666412 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:57:01 +00:00
David Reiss
c85a695588 Add mkdir ${TARGET_DIR} to erl test Makefile since the empty ebin/ dir doesn't stay in git
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666411 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:56:55 +00:00
David Reiss
f4761e324e Fix thrift_server to create transport and protocol inside the processor rather than inside the acceptor.
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
2008-06-11 00:56:49 +00:00
David Reiss
da07067489 Fix error logging to actually print error and stack trace for caught errors
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666408 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:56:42 +00:00
David Reiss
920959a655 Handle crashes/errors in the processor by sending back a serialized exception
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666407 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:56:35 +00:00
David Reiss
c308d6989e Add thrift_server:stop/1 to stop a running server
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666405 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 00:56:25 +00:00
David Reiss
60b50cf385 Add stress test implementation for new Erlang
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666389 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:59:10 +00:00
David Reiss
cc10b8a80c Don't actually ignore all makefiles in .gitignore -- erl makefiles are important!
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666388 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:59:02 +00:00
David Reiss
c0cce962ac Oops - forgot to add the test/erl/Makefile to git
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666387 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:58 +00:00
David Reiss
90b4083d4c Implement buffered transport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666386 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:52 +00:00
David Reiss
57b4d9a4ac Test server for erlang
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666385 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:39 +00:00
David Reiss
982c72de7b Properly handle exceptions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666384 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:33 +00:00
David Reiss
eea8298ee3 Fix reading of empty structs/arg lists
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666383 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:21 +00:00
David Reiss
e1a7998837 Fix responses for void functions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666382 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:14 +00:00
David Reiss
d93521b880 Make strings read as lists, not as binary
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666381 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:58:07 +00:00
David Reiss
07a725f038 Make signedness of integers explicit, and fix double read/write.
Also fix typo of i63 for i64


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666380 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:59 +00:00
David Reiss
11300fe872 Properly uncapitalize package names when referencing structs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666379 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:52 +00:00
David Reiss
0c9b516506 Fix generation when multiple services are in the same service definition
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666378 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:44 +00:00
David Reiss
76f0d11dc9 Generator for alternative erl bindings, as well as a few more changes to lib code.
- 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
2008-06-10 22:57:35 +00:00
David Reiss
1c1ca74237 Make processor use a service definition and handler to determine types
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666376 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:21 +00:00
David Reiss
ae756f4561 Read and write of structs, lists, maps, and sets
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666375 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:57:11 +00:00
David Reiss
ac549554f4 Initial commit of alternative erlang lib
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666374 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:59 +00:00
David Reiss
176ed368a3 Avoid a filename collision on case-insensitive filesystems.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666373 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:48 +00:00
David Reiss
a1e0a6f0d8 Don't generate a constants file if there are no constants (Java only).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666372 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:43 +00:00
David Reiss
87e9ac6382 Fix a bug with initialization in JavaBean-style generated code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666371 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:34 +00:00
David Reiss
5245f40b3e Print an error instead of segfaulting with a bad compiler command line.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666370 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:26 +00:00
David Reiss
9d866ac231 Add newlines to some warning messages in the compiler.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666369 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:19 +00:00
David Reiss
0babe40d74 Fix some warnings caused by treating string literals as non-const.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666368 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:56:12 +00:00
David Reiss
13aea4600c Fix IPv6 on FreeBSD.
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
2008-06-10 22:56:04 +00:00
David Reiss
d14f4f86d4 Fix some indentation in the PHP generator.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666366 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:54 +00:00
David Reiss
c0092f973d PHP Generator: Throw an exception on bad types.
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
2008-06-10 22:55:46 +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
c6dab61300 Thrift: Allow for alternative Mutex initializers.
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
2008-06-10 22:55:13 +00:00
David Reiss
e3a64923e9 Fix locking bug in ThreadManager.
It looks like the scheduler waits on monitor_, but the worker notifies
workerMonitor_. Also, it does so out of critical section.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666361 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:04 +00:00
David Reiss
791a57f528 FunctionRunner Utility Class.
Runs arbitrary functions of form 'void(void)' and 'void*(void*)'
without need to create custom Runnable classes.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666360 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:54:56 +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
af296954ea Add ProfilerRegisterThead() to PosixThread.
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
2008-06-10 22:54:40 +00:00
David Reiss
c89e4de509 Make sure list<byte> is List<Byte> in Java gen'd code.
Reviewed By: dreiss

Test Plan: Generate list<byte> into Java


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666357 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:54:32 +00:00
David Reiss
7dab93e237 Fix a few copy-paste errors in TBufferTransports (not code).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665684 13f79535-47bb-0310-9956-ffa450edef68
2008-05-09 19:18:29 +00:00
David Reiss
f9b5b12f4d Tweak Java Makefile.ams to fix "make distclean".
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
2008-05-09 07:17:35 +00:00
David Reiss
33fc5adb2b Check for ptrdiff_t and fail if we don't have it.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665682 13f79535-47bb-0310-9956-ffa450edef68
2008-05-09 07:17:34 +00:00
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
8df6c82aa7 Switch md5 implementations.
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
2008-05-04 03:00:22 +00:00
David Reiss
de59292f38 Remove an unnecessary include of boost/lexical_cast.hpp
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665678 13f79535-47bb-0310-9956-ffa450edef68
2008-05-01 20:51:03 +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
9a4edfa07f Properly handle constants of typedef'ed types.
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
2008-05-01 05:52:50 +00:00