common/thrift.git
16 years agoremoving more debug_rlogs
David Reiss [Wed, 11 Jun 2008 01:01:06 +0000 (01:01 +0000)] 
removing more debug_rlogs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666442 13f79535-47bb-0310-9956-ffa450edef68

16 years agook: good to go
David Reiss [Wed, 11 Jun 2008 01:00:59 +0000 (01:00 +0000)] 
ok: good to go

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666441 13f79535-47bb-0310-9956-ffa450edef68

16 years agodon't do an exit(normal)
David Reiss [Wed, 11 Jun 2008 01:00:52 +0000 (01:00 +0000)] 
don't do an exit(normal)

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666440 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadd a close to thrift_client to close the underlying transport
David Reiss [Wed, 11 Jun 2008 01:00:45 +0000 (01:00 +0000)] 
add a close to thrift_client to close the underlying transport

Reviewed By: eletuchy

Notes: the thrift_buffered_transport exits with {normal,{gen_server,call,[Pid,close]}} right now, but it should only exit with normal.  marked todo.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666439 13f79535-47bb-0310-9956-ffa450edef68

16 years agodon't need to use gen_server:reply
David Reiss [Wed, 11 Jun 2008 01:00:37 +0000 (01:00 +0000)] 
don't need to use gen_server:reply

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666438 13f79535-47bb-0310-9956-ffa450edef68

16 years agochanging thrift_processor shutdown to compy with proc_lib standards
David Reiss [Wed, 11 Jun 2008 01:00:30 +0000 (01:00 +0000)] 
changing thrift_processor shutdown to compy with proc_lib standards

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666437 13f79535-47bb-0310-9956-ffa450edef68

16 years agoallow configurable recv_timeouts
David Reiss [Wed, 11 Jun 2008 01:00:20 +0000 (01:00 +0000)] 
allow configurable recv_timeouts

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666435 13f79535-47bb-0310-9956-ffa450edef68

16 years agoremoving two more debug messages
David Reiss [Wed, 11 Jun 2008 01:00:12 +0000 (01:00 +0000)] 
removing two more debug messages

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666434 13f79535-47bb-0310-9956-ffa450edef68

16 years agoremoved extra debugging statements
David Reiss [Wed, 11 Jun 2008 01:00:04 +0000 (01:00 +0000)] 
removed extra debugging statements

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666433 13f79535-47bb-0310-9956-ffa450edef68

16 years agooops forgot a file
David Reiss [Wed, 11 Jun 2008 00:59:55 +0000 (00:59 +0000)] 
oops forgot a file

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666432 13f79535-47bb-0310-9956-ffa450edef68

16 years agomochiweb style avoidance of gen_tcp:controlling_process
David Reiss [Wed, 11 Jun 2008 00:59:48 +0000 (00:59 +0000)] 
mochiweb style avoidance of gen_tcp:controlling_process

TODO: remove extraneous debug_rlogs

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666431 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_buffered_transport leak in erl bindings
David Reiss [Wed, 11 Jun 2008 00:59:34 +0000 (00:59 +0000)] 
Fix thrift_buffered_transport leak in erl bindings

Summary:
  - Was leaking processes when the client cleanly disconnected since the
    thrift_processor process was exiting with 'normal' Reason. Changed it
    to 'protocol_closed'

Test plan:
  - Telnet to thrift service port and close (^]close) before the read timeout
    elapses. Verify that erlang:system_info(process_count) does not increase
    after doing this multiple times.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666430 13f79535-47bb-0310-9956-ffa450edef68

16 years agoif instead of case for a guard comparison
David Reiss [Wed, 11 Jun 2008 00:59:27 +0000 (00:59 +0000)] 
if instead of case for a guard comparison

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666429 13f79535-47bb-0310-9956-ffa450edef68

16 years agofixing behavior declaration for thrift_transport
David Reiss [Wed, 11 Jun 2008 00:59:19 +0000 (00:59 +0000)] 
fixing behavior declaration for thrift_transport

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666428 13f79535-47bb-0310-9956-ffa450edef68

16 years agomicro optimization in thrift_processor
David Reiss [Wed, 11 Jun 2008 00:59:12 +0000 (00:59 +0000)] 
micro optimization in thrift_processor

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666427 13f79535-47bb-0310-9956-ffa450edef68

16 years agouse type-appropriate methods for size and map for dict and set structures
David Reiss [Wed, 11 Jun 2008 00:59:03 +0000 (00:59 +0000)] 
use type-appropriate methods for size and map for dict and set structures

Reviewed By: cpiro

Test Plan: TODO

Revert Plan: sure

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666426 13f79535-47bb-0310-9956-ffa450edef68

16 years agoadding make dialyzer for fun and profit
David Reiss [Wed, 11 Jun 2008 00:58:55 +0000 (00:58 +0000)] 
adding make dialyzer for fun and profit

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666425 13f79535-47bb-0310-9956-ffa450edef68

16 years agoallow writing binaries in thrift_binary_protocol
David Reiss [Wed, 11 Jun 2008 00:58:48 +0000 (00:58 +0000)] 
allow writing binaries in thrift_binary_protocol

Summary: they come packed in {string, Bin} so pull them out

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666424 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix warning in generated source for alterl bindings
David Reiss [Wed, 11 Jun 2008 00:58:41 +0000 (00:58 +0000)] 
Fix warning in generated source for alterl bindings

Summary:
  - Was previously including both the fall-through to the base service as well as the "dummy" fallthrough function clause. This generated a warning like:

  gen-erl/redacted_thrift.erl:134: Warning: this clause cannot match because a previous clause at line 132 always matches

  Now we only include the "dummy" function if there is no base class to fall through to.

Test plan: Generated tutorial.thrift and shared.thrift, compiled without warnings

Notes: It's probably possible to have a circular inheritance graph, which would cause an infinite loop at runtime. Do we care about this?

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666423 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement inheritance in the alterl generator
David Reiss [Wed, 11 Jun 2008 00:58:33 +0000 (00:58 +0000)] 
Implement inheritance in the alterl generator

Summary:
  - Simply forwards function_info calls through to the base service

Test plan: cpiro will test it?

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666422 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement TApplicationException handling in alt_erl client
David Reiss [Wed, 11 Jun 2008 00:58:25 +0000 (00:58 +0000)] 
Implement TApplicationException handling in alt_erl client

Summary:
  Throws a 'TApplicationException' record

Test plan:
  Changed cpp TestServer so that if testException is called with "ApplicationException" as an argument, it throws a TException which is serialized back as an EXCEPTION type message

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666421 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd a README to alterl which shows how to use thrift_client
David Reiss [Wed, 11 Jun 2008 00:58:13 +0000 (00:58 +0000)] 
Add a README to alterl which shows how to use thrift_client

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666420 13f79535-47bb-0310-9956-ffa450edef68

16 years agoRemove extra debugging from thrift_client.erl
David Reiss [Wed, 11 Jun 2008 00:58:07 +0000 (00:58 +0000)] 
Remove extra debugging from thrift_client.erl

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666419 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd a thrift client to alterl bindings
David Reiss [Wed, 11 Jun 2008 00:58:00 +0000 (00:58 +0000)] 
Add a thrift client to alterl bindings

Test plan:
  f(), {ok, C} = thrift_client:start_link("localhost", 9090, thriftTest_thrift).
  thrift_client:call(C, testAsync, [1234]).
  thrift_client:call(C, testVoid, []).
  thrift_client:call(C, testList, [[1,2,3,4,5]]).

  - Should write an actual test suite that exercises all of ThriftTest but I'm lazy right now

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666418 13f79535-47bb-0310-9956-ffa450edef68

16 years agoChange alterl thrift_server to use non-blocking TCP calls and properly set the proces...
David Reiss [Wed, 11 Jun 2008 00:57:54 +0000 (00:57 +0000)] 
Change alterl thrift_server to use non-blocking TCP calls and properly set the processor as the controlling process for the client sockets.

Summary:
  - Removes the non-OTP "acceptor" process
  - The processor becomes the socket's controlling process instead of the transport, which is kind of messy, but it means we don't have to make a process for the socket_transport.
  - See http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles for non-blocking server info

Test plan:
  - Ran ThriftTest and StressTest

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666417 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix thrift_processor so that exceptions thrown in async void functions don't get...
David Reiss [Wed, 11 Jun 2008 00:57:42 +0000 (00:57 +0000)] 
Fix thrift_processor so that exceptions thrown in async void functions don't get serialized

Test plan: Made testAsync() in test_server always crash with a badmatch 1 = 0,
           and made sure that the badmatch was caught and logged but not
   serialized back to the client

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666416 13f79535-47bb-0310-9956-ffa450edef68

16 years agoImplement async_void in alterl bindings
David Reiss [Wed, 11 Jun 2008 00:57:35 +0000 (00:57 +0000)] 
Implement async_void in alterl bindings

Summary:
  - reply_type for async void functions is now async_void instead of
    the empty struct definition
  - async void functions should return "ok". otherwise the processor
    will crash and the connection will be killed. Is this behaviour
    expected?

Test Plan: tested using testAsync() in ThriftTest. Didn't used to work
           but works now

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666415 13f79535-47bb-0310-9956-ffa450edef68

16 years agoComment out some noisy output from thrift_processor and thrift_server
David Reiss [Wed, 11 Jun 2008 00:57:19 +0000 (00:57 +0000)] 
Comment out some noisy output from thrift_processor and thrift_server

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666414 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd build/ dir for alterl bindings and remove them from .gitignore
David Reiss [Wed, 11 Jun 2008 00:57:11 +0000 (00:57 +0000)] 
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

16 years agoImplement testAsync for python tests
David Reiss [Wed, 11 Jun 2008 00:57:01 +0000 (00:57 +0000)] 
Implement testAsync for python tests

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666412 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAdd mkdir ${TARGET_DIR} to erl test Makefile since the empty ebin/ dir doesn't stay...
David Reiss [Wed, 11 Jun 2008 00:56:55 +0000 (00:56 +0000)] 
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

16 years agoFix thrift_server to create transport and protocol inside the processor rather than...
David Reiss [Wed, 11 Jun 2008 00:56:49 +0000 (00:56 +0000)] 
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

16 years agoFix error logging to actually print error and stack trace for caught errors
David Reiss [Wed, 11 Jun 2008 00:56:42 +0000 (00:56 +0000)] 
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

16 years agoHandle crashes/errors in the processor by sending back a serialized exception
David Reiss [Wed, 11 Jun 2008 00:56:35 +0000 (00:56 +0000)] 
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

16 years agoAdd thrift_server:stop/1 to stop a running server
David Reiss [Wed, 11 Jun 2008 00:56:25 +0000 (00:56 +0000)] 
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

16 years agoAdd stress test implementation for new Erlang
David Reiss [Tue, 10 Jun 2008 22:59:10 +0000 (22:59 +0000)] 
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

16 years agoDon't actually ignore all makefiles in .gitignore -- erl makefiles are important!
David Reiss [Tue, 10 Jun 2008 22:59:02 +0000 (22:59 +0000)] 
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

16 years agoOops - forgot to add the test/erl/Makefile to git
David Reiss [Tue, 10 Jun 2008 22:58:58 +0000 (22:58 +0000)] 
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

16 years agoImplement buffered transport
David Reiss [Tue, 10 Jun 2008 22:58:52 +0000 (22:58 +0000)] 
Implement buffered transport

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666386 13f79535-47bb-0310-9956-ffa450edef68

16 years agoTest server for erlang
David Reiss [Tue, 10 Jun 2008 22:58:39 +0000 (22:58 +0000)] 
Test server for erlang

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666385 13f79535-47bb-0310-9956-ffa450edef68

16 years agoProperly handle exceptions
David Reiss [Tue, 10 Jun 2008 22:58:33 +0000 (22:58 +0000)] 
Properly handle exceptions

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666384 13f79535-47bb-0310-9956-ffa450edef68

16 years agoFix reading of empty structs/arg lists
David Reiss [Tue, 10 Jun 2008 22:58:21 +0000 (22:58 +0000)] 
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

16 years agoFix responses for void functions
David Reiss [Tue, 10 Jun 2008 22:58:14 +0000 (22:58 +0000)] 
Fix responses for void functions

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666382 13f79535-47bb-0310-9956-ffa450edef68

16 years agoMake strings read as lists, not as binary
David Reiss [Tue, 10 Jun 2008 22:58:07 +0000 (22:58 +0000)] 
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

16 years agoMake signedness of integers explicit, and fix double read/write.
David Reiss [Tue, 10 Jun 2008 22:57:59 +0000 (22:57 +0000)] 
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

16 years agoProperly uncapitalize package names when referencing structs
David Reiss [Tue, 10 Jun 2008 22:57:52 +0000 (22:57 +0000)] 
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

16 years agoFix generation when multiple services are in the same service definition
David Reiss [Tue, 10 Jun 2008 22:57:44 +0000 (22:57 +0000)] 
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

16 years agoGenerator for alternative erl bindings, as well as a few more changes to lib code.
David Reiss [Tue, 10 Jun 2008 22:57:35 +0000 (22:57 +0000)] 
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

16 years agoMake processor use a service definition and handler to determine types
David Reiss [Tue, 10 Jun 2008 22:57:21 +0000 (22:57 +0000)] 
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

16 years agoRead and write of structs, lists, maps, and sets
David Reiss [Tue, 10 Jun 2008 22:57:11 +0000 (22:57 +0000)] 
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

16 years agoInitial commit of alternative erlang lib
David Reiss [Tue, 10 Jun 2008 22:56:59 +0000 (22:56 +0000)] 
Initial commit of alternative erlang lib

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666374 13f79535-47bb-0310-9956-ffa450edef68

16 years agoAvoid a filename collision on case-insensitive filesystems.
David Reiss [Tue, 10 Jun 2008 22:56:48 +0000 (22:56 +0000)] 
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

16 years agoDon't generate a constants file if there are no constants (Java only).
David Reiss [Tue, 10 Jun 2008 22:56:43 +0000 (22:56 +0000)] 
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

16 years agoFix a bug with initialization in JavaBean-style generated code.
David Reiss [Tue, 10 Jun 2008 22:56:34 +0000 (22:56 +0000)] 
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

16 years agoPrint an error instead of segfaulting with a bad compiler command line.
David Reiss [Tue, 10 Jun 2008 22:56:26 +0000 (22:56 +0000)] 
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

16 years agoAdd newlines to some warning messages in the compiler.
David Reiss [Tue, 10 Jun 2008 22:56:19 +0000 (22:56 +0000)] 
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

16 years agoFix some warnings caused by treating string literals as non-const.
David Reiss [Tue, 10 Jun 2008 22:56:12 +0000 (22:56 +0000)] 
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

16 years agoFix IPv6 on FreeBSD.
David Reiss [Tue, 10 Jun 2008 22:56:04 +0000 (22:56 +0000)] 
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

16 years agoFix some indentation in the PHP generator.
David Reiss [Tue, 10 Jun 2008 22:55:54 +0000 (22:55 +0000)] 
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

16 years agoPHP Generator: Throw an exception on bad types.
David Reiss [Tue, 10 Jun 2008 22:55:46 +0000 (22:55 +0000)] 
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

16 years agoChange Python servers to use the standard logging module.
David Reiss [Tue, 10 Jun 2008 22:55:38 +0000 (22:55 +0000)] 
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

16 years agoPython forking server should close connection in parent.
David Reiss [Tue, 10 Jun 2008 22:55:26 +0000 (22:55 +0000)] 
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

16 years agoThrift: Allow for alternative Mutex initializers.
David Reiss [Tue, 10 Jun 2008 22:55:13 +0000 (22:55 +0000)] 
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

16 years agoFix locking bug in ThreadManager.
David Reiss [Tue, 10 Jun 2008 22:55:04 +0000 (22:55 +0000)] 
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

16 years agoFunctionRunner Utility Class.
David Reiss [Tue, 10 Jun 2008 22:54:56 +0000 (22:54 +0000)] 
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

16 years agoForking Python server.
David Reiss [Tue, 10 Jun 2008 22:54:49 +0000 (22:54 +0000)] 
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

16 years agoAdd ProfilerRegisterThead() to PosixThread.
David Reiss [Tue, 10 Jun 2008 22:54:40 +0000 (22:54 +0000)] 
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

16 years agoMake sure list<byte> is List<Byte> in Java gen'd code.
David Reiss [Tue, 10 Jun 2008 22:54:32 +0000 (22:54 +0000)] 
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

17 years agoFix a few copy-paste errors in TBufferTransports (not code).
David Reiss [Fri, 9 May 2008 19:18:29 +0000 (19:18 +0000)] 
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

17 years agoTweak Java Makefile.ams to fix "make distclean".
David Reiss [Fri, 9 May 2008 07:17:35 +0000 (07:17 +0000)] 
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

17 years agoCheck for ptrdiff_t and fail if we don't have it.
David Reiss [Fri, 9 May 2008 07:17:34 +0000 (07:17 +0000)] 
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

17 years agoC++/TFramedTransport: Don't write an empty frame on flush.
David Reiss [Fri, 9 May 2008 07:14:10 +0000 (07:14 +0000)] 
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

17 years agoFix a small logic error in TBufferedTransport::borrowSlow.
David Reiss [Fri, 9 May 2008 00:40:26 +0000 (00:40 +0000)] 
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

17 years agoSwitch md5 implementations.
David Reiss [Sun, 4 May 2008 03:00:22 +0000 (03:00 +0000)] 
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

17 years agoRemove an unnecessary include of boost/lexical_cast.hpp
David Reiss [Thu, 1 May 2008 20:51:03 +0000 (20:51 +0000)] 
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

17 years agoThrow a transport exception if fstat fails.
David Reiss [Thu, 1 May 2008 06:21:04 +0000 (06:21 +0000)] 
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

17 years agoMemory-based transport rewrite.
David Reiss [Thu, 1 May 2008 06:17:36 +0000 (06:17 +0000)] 
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

17 years agoProperly handle constants of typedef'ed types.
David Reiss [Thu, 1 May 2008 05:52:50 +0000 (05:52 +0000)] 
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

17 years agoEliminate an unused local variable.
David Reiss [Thu, 1 May 2008 05:52:49 +0000 (05:52 +0000)] 
Eliminate an unused local variable.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665674 13f79535-47bb-0310-9956-ffa450edef68

17 years agoRemove a few unnecessary includes to speed up compiles.
David Reiss [Thu, 1 May 2008 05:52:48 +0000 (05:52 +0000)] 
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

17 years agoC++: Make write{Struct,Field}Begin take "name" as a const char*.
David Reiss [Tue, 29 Apr 2008 23:12:24 +0000 (23:12 +0000)] 
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

17 years agoJava: In toString for generated structs, handle nulls.
David Reiss [Tue, 29 Apr 2008 23:09:11 +0000 (23:09 +0000)] 
Java: In toString for generated structs, handle nulls.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665671 13f79535-47bb-0310-9956-ffa450edef68

17 years agoThrift REST parsing allows null object params
David Reiss [Tue, 29 Apr 2008 00:29:45 +0000 (00:29 +0000)] 
Thrift REST parsing allows null object params

Summary: If JSON objects are passed in allow them to be null and don'\''t default construct.

Reviewed By: dreiss

Test Plan: Regenerate API code and test on object args.

Revert: OK

DiffCamp Revision: 12407

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665670 13f79535-47bb-0310-9956-ffa450edef68

17 years agoTHRIFT: Nonblcoking bug fix
David Reiss [Tue, 29 Apr 2008 00:29:43 +0000 (00:29 +0000)] 
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

17 years agoPersistent conns in TSocketPool
David Reiss [Tue, 29 Apr 2008 00:29:41 +0000 (00:29 +0000)] 
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

17 years agoAdd a missing include to Benchmark.cpp to make it build on Mac OS.
David Reiss [Mon, 28 Apr 2008 02:51:44 +0000 (02:51 +0000)] 
Add a missing include to Benchmark.cpp to make it build on Mac OS.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665667 13f79535-47bb-0310-9956-ffa450edef68

17 years agoSilence a valgrind complaint by matching "delete[]" with "new[]".
David Reiss [Mon, 28 Apr 2008 02:42:28 +0000 (02:42 +0000)] 
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

17 years agoVersion bump to 20080411.
David Reiss [Mon, 21 Apr 2008 18:08:07 +0000 (18:08 +0000)] 
Version bump to 20080411.

Also updated CONTRIBUTORS and NEWS.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665665 13f79535-47bb-0310-9956-ffa450edef68

17 years agoAdd build.xml, src, and LICENSE to EXTRA_DIST in lib/java/Makefile.am.
David Reiss [Mon, 21 Apr 2008 18:08:01 +0000 (18:08 +0000)] 
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

17 years agoAdd TBase64Utils.h and TJSONProto.h to lib/cpp/Makefile.am.
David Reiss [Mon, 21 Apr 2008 18:07:58 +0000 (18:07 +0000)] 
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

17 years agoAdd contrib to EXTRA_DIST so it goes into make dist.
David Reiss [Mon, 21 Apr 2008 18:07:53 +0000 (18:07 +0000)] 
Add contrib to EXTRA_DIST so it goes into make dist.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665662 13f79535-47bb-0310-9956-ffa450edef68

17 years agoAdd a distdir rule to lib/erl/Makefile to make "make check" happy.
David Reiss [Mon, 21 Apr 2008 18:07:49 +0000 (18:07 +0000)] 
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

17 years agoCheck for ssize_t in configure.ac.
David Reiss [Mon, 21 Apr 2008 18:07:43 +0000 (18:07 +0000)] 
Check for ssize_t in configure.ac.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665660 13f79535-47bb-0310-9956-ffa450edef68

17 years agoDelete a crazy line from fb303's build.xml.
David Reiss [Sun, 20 Apr 2008 05:28:14 +0000 (05:28 +0000)] 
Delete a crazy line from fb303's build.xml.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665659 13f79535-47bb-0310-9956-ffa450edef68

17 years agoThrift: bug fix for interrupting server socket
David Reiss [Fri, 18 Apr 2008 17:48:03 +0000 (17:48 +0000)] 
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

17 years agoAdd a few missing includes.
David Reiss [Tue, 15 Apr 2008 05:44:00 +0000 (05:44 +0000)] 
Add a few missing includes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665657 13f79535-47bb-0310-9956-ffa450edef68

17 years agoFix Thrift.cpp for non-Linux systems.
David Reiss [Fri, 11 Apr 2008 22:36:31 +0000 (22:36 +0000)] 
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

17 years agoAdd simple "check" and "distclean" targets to lib/erl/Makefile.
David Reiss [Fri, 11 Apr 2008 22:00:06 +0000 (22:00 +0000)] 
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

17 years agoRemove some .pyc files from fb303.
David Reiss [Fri, 11 Apr 2008 22:00:00 +0000 (22:00 +0000)] 
Remove some .pyc files from fb303.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665654 13f79535-47bb-0310-9956-ffa450edef68

17 years agoWhitespace change for consistency.
David Reiss [Fri, 11 Apr 2008 21:59:45 +0000 (21:59 +0000)] 
Whitespace change for consistency.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665653 13f79535-47bb-0310-9956-ffa450edef68