Commit Graph

3856 Commits

Author SHA1 Message Date
Christopher Tubbs
ebfa771a26 THRIFT-5274: Enforce Java 8 compatibility
Client: Java
Patch: Christopher Tubbs

This closes #2325

* Enforce Java 8 compatibility using the new `--release` flag introduced
  in JDK9, so that all generated bytecode follows Java 8 strict
  compatibility, even when building with newer JDK versions (9 or later)
  (this fixes NoSuchMethodError with ByteBuffer, and other potential
  incompatibilities in bytecode generation that would make the code
  unable to run on a Java 8 JRE)
* Also strictly enforce the JDK version used to build the project by
  ensuring it is at least version 1.8, and will fail fast when building
  the Java libraries if this condition is not met.
2021-02-04 22:10:30 +01:00
David Mollitor
7ae1ec3f1e THRIFT-5297: Improve TThreadPoolServer Handling of Incoming Connections
Client: Java
Patch: David Mollitor

This closes #2266
2021-02-04 16:39:48 +01:00
belugabehr
ebc2ab558d
THRIFT-5345: Allow the ServerContext to be Unwrapped Programmatically
Client: Java
Patch: David Mollitor
2021-02-04 09:14:11 -05:00
James Lacey
55016bff2b THRIFT-5343: TTlsSocketTransport does not resolve IPv4 addresses or validate hostnames correctly
Client: netstd
Patch: James Lacey

This closes #2322
2021-02-04 10:21:36 +01:00
wangtieju
4aaef75819 THRIFT-5337 Go set fields write improvement
Client: go

There is a duplicate elements check for set in writeFields* function,
and it compares elements using reflect.DeepEqual which is expensive.

It's much faster that generates a *Equals* function for set elements and
call it in duplicate elements check, especially for nested struct
element.

Closes #2307.
2021-02-03 21:05:22 -08:00
Jens Geyer
1f73455940 THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class (cpp)
Client: cpp
Patch: Jens Geyer

Fixes an issue introduced with that ticket
2021-02-03 13:35:36 +01:00
vladimir.panivko
0f21e39c9b THRIFT-5336 Add possibility to setup connection timeout in TCurlClient
Patch: Vladimir Panivko
Client: php

This closes #2306
2021-01-24 12:33:48 +01:00
Yuxuan 'fishy' Wang
c2ddaf0766 THRIFT-4914: Make TClient.Call to return the response meta
Client: go

Make a breaking change so that TClient.Call returns the response
meta, currently only contains headers but could be expanded in the
future, and make a compiler change to compiler generated clients to take
advantage of that and provide access to response metadata to users.
2021-01-22 20:50:27 -08:00
Yuxuan 'fishy' Wang
8dd04f4adf THRIFT-5322: THeaderTransport protocol id fix
Client: go

This fixes a bug introduced in
https://github.com/apache/thrift/pull/2296, that we mixed the preferred
proto id and the detected proto id, which was a bad idea.

This change separates them, so when we propagate TConfiguration, we only
change the preferred one, which will only be used for new connections,
and leave the detected one from existing connections untouched.

Also add a test for it.
2021-01-22 20:49:57 -08:00
Yuxuan 'fishy' Wang
d9fcdd3dba THRIFT-5338: Remove lib/go/thrift/go.mod
Client: go

Having it under a subdirectory has some unexpected consequences, so
remove it for now. Another PR will be open up later to add it back to
the root directory.
2021-01-20 11:49:24 -08:00
Yuxuan 'fishy' Wang
e27e82c46b THRIFT-5338: Raise minimal supported go version to 1.14.14
Client: go

- Update Dockerfiles used by travis
- Add go.mod file
- Modify error handling code to take advantage of errors package updates
  in go1.13
2021-01-20 09:11:02 -08:00
Yuxuan 'fishy' Wang
0e68e8c51b THRIFT-5326: Make PrependError more unwrap-able
Client: go

As a follow up to https://github.com/apache/thrift/pull/2298, make the
error returned by PrependError unwrap-able in certain cases.
2021-01-19 10:46:29 -08:00
Yuxuan 'fishy' Wang
d831230929 THRIFT-5326: Expand TException interface in go library
Client: go

Add TExceptionType enum type, and add

    TExceptionType() TExceptionType

function to TException definition.

Also make TProtocolException unwrap-able.
2021-01-17 15:19:44 -08:00
Yuxuan 'fishy' Wang
c4d1c0d800 THRIFT-5322: Implement TConfiguration in Go library
Client: go

Define TConfiguration following the spec, and also move the following
configurations scattered around different TTransport/TProtocol into it:

- connect and socket timeouts for TSocket and TSSLSocket
- tls config for TSSLSocket
- max frame size for TFramedTransport
- strict read and strict write for TBinaryProtocol
- proto id for THeaderTransport

Also add TConfiguration support for the following and their factories:

- THeaderTransport and THeaderProtocol
- TBinaryProtocol
- TCompactProtocol
- TFramedTransport
- TSocket
- TSSLSocket

Also define TConfigurationSetter interface for easier TConfiguration
propagation between wrapped TTransports/TProtocols , and add
implementations to the following for propagation
(they don't use anything from TConfiguration themselves):

- StreamTransport
- TBufferedTransport
- TDebugProtocol
- TJSONProtocol
- TSimpleJSONProtocol
- TZlibTransport

TConfigurationSetter are not implemented by the factories of the
"propagation only" TTransports/TProtocols, if they have a factory. For
those use cases, TTransportFactoryConf and TProtocolFactoryConf are
provided to wrap a factory with the ability to propagate TConfiguration.

Also add simple sanity check for TBinaryProtocol and TCompactProtocol's
ReadString and ReadBinary functions. Currently it only report error if
the header length is larger than MaxMessageSize configured in
TConfiguration, for simplicity.
2021-01-17 12:24:13 -08:00
Neil Williams
1c35d6ba95
THRIFT-5331: Py: make THeader subprotocol configurable (#2302)
Client: py

This allows clients to choose which subprotocol (TBinary/TCompact) to frame with headers. The server will already accept either protocol and reply correctly.
2021-01-04 11:27:01 -08:00
Jeffrey Han
13662dd7be THRIFT-5325: Fix Lua library writeStructEnd() in TCompactProtocol
Client: lua
Patch: Jeffrey Han

This closes #2297
2020-12-22 02:11:09 +01:00
Mario Emmenlauer
3b9259d88b TServerSocket.cpp::isOpen(): Check that a domain socket file already exists 2020-12-19 14:22:13 +08:00
Yuxuan 'fishy' Wang
37c2ceb737 THRIFT-5322: Guard against large string/binary lengths in Go
Client: go

In TBinaryProtocol.ReadString, TBinaryProtocol.ReadBinary,
TCompactProtocol.ReadString, and TCompactProtocol.ReadBinary, use
safeReadBytes to prevent from large allocation on malformed sizes.

    $ go test -bench=SafeReadBytes -benchmem
    BenchmarkSafeReadBytes/normal-12                  625057              1789 ns/op            2176 B/op          5 allocs/op
    BenchmarkSafeReadBytes/max-askedSize-12           545271              2236 ns/op           14464 B/op          7 allocs/op
    PASS
2020-12-16 09:31:18 -08:00
Yuxuan 'fishy' Wang
dda80547b1 THRIFT-5324: Create new req buffer for every http request
Client: go

The fix in https://github.com/apache/thrift/pull/2293 doesn't work for
go1.10.8 due to the possibility of data races. This exposes a bigger,
underlying issue regarding the ownership of the request buffer in
THttpClient between THttpClient itself and the http request it creates.
Instead of reset and reuse the same buffer, always give up the ownership
of it and create a new buffer after each Flush call.
2020-12-16 09:27:25 -08:00
Jeffrey Han
e872b350ab THRIFT-5282: Add IPv6 client support to Lua library
Client: lua
Patch: Jeffrey Han

This closes #2243
2020-12-15 21:04:14 +01:00
Morozov
4461728f18
THRIFT-5324: reset http client buffer after flush
THttpClient did not reset its internal buffer when HTTP client returned
an error, leaving the whole or partially read message in the buffer.
Now we reset the buffer in defer.

Client: go
2020-12-15 07:35:57 +00:00
Dirkjan Ochtman
70792f2191 Add useful links in Rust client's metadata
Client: Rust
Patch: Dirkjan Ochtman

This closes #2291
2020-12-09 22:12:14 +01:00
rglarix
10f2556733 THRIFT-5295 makeThread and ThreadFactory extensible
Client: cpp
Patch: Riccardo Ghetta

This closes #2260

Signed-off-by: rglarix <rglarix@users.noreply.github.com>
2020-12-08 22:19:33 +01:00
zeshuai007
fb4b5aa17b Fix Missed check in c_glib for frame max message size check 2020-12-05 14:36:43 +08:00
Jens Geyer
12f6c31c8d THRIFT-5320: Usage of "Task" as IDL identifier generates uncompileable code
Client: netstd
Patch: Jens Geyer

This closes #2289
2020-12-04 21:05:43 +01:00
Sergey Yelin
66777ad215 Fix Erlang CI: Add gen-erl into test's path
Client: erl
Patch: Sergey Yelin

This closes #2290
2020-12-04 21:03:01 +01:00
Mario Emmenlauer
c0619235bd Make ~TException() virtual
Client: cpp
Patch: Mario Emmenlauer

This closes #2281
2020-12-03 23:01:53 +01:00
David Mollitor
6e6bb84be9 THRIFT-5288: Move Support for ByteBuffer into TTransport
Client: Java
Patch: David Mollitor

This closes #2254
2020-11-19 22:35:37 +01:00
Allen George
6cd5366b5f
Merge pull request #2273 from allengeorge/allen/clippy_clean
THRIFT-5306: Rust code and generated code no longer has clippy warnings (Rust 1.40)
2020-11-18 10:24:41 -05:00
Allen George
7ddbcc07ec
THRIFT-5306: Rust code and generated code no longer has clippy warnings (Rust 1.40)
Client: rs

NOTE: Also properly update the min/max supported Rust versions
2020-11-12 08:47:42 -05:00
stiga-huang
05bb551486 THRIFT-5303 Fix missing error handling in using PyUnicode_DecodeUTF8
Client: py
Patch: stiga-huang

This closes #2269
2020-11-01 18:17:18 +01:00
zeshuai007
997e2d42db fix warning in c_glib from add max_message_size code 2020-10-31 09:13:37 +08:00
Jens Geyer
6762cad25c THRIFT-5304 TWinHTTPClientImpl may incorrectly report that the message size is reached
Client: Delphi
Patch: Jens Geyer
2020-10-30 18:26:21 +01:00
Mark Raynsford
22671db01f Add an Automatic-Module-Name entry
This adds an Automatic-Module-Name entry to the Thrift jar manifest
in order to provide Thrift with a stable module name when used in a
JPMS modular context. The name chosen here is "org.apache.thrift",
which matches the symbolic name used for OSGi.

See: http://branchandbound.net/blog/java/2017/12/automatic-module-name/
2020-10-24 10:55:27 +08:00
Yuxuan 'fishy' Wang
2676327f6e Add DuplicateTo protocol to go's TDebugProtocol
This also comes from the discussion of
https://github.com/apache/thrift/pull/1992#issuecomment-705903922.
I think TDebugProtocol is a better fit for this feature than creating a
new TProtocol implementation.

The DuplicateTo field is not added to TDebugProtocolFactory because I
don't think it makes sense from the factory setup. In vast majority
cases users would need direct access to the underlying TMemoryBuffer to
make it useful, which is easier this way than an additional
TTransportFactory plus TProtocolFactory to make TDebugProtocolFactory
way too complicated.
2020-10-19 14:21:44 -07:00
Yuxuan 'fishy' Wang
64c2a4b87a THRIFT-5294: Fix panic in go TSimpleJSONProtocol
Client: go

In go library's TSimpleJSONProtocol and TJSONProtocol implementations,
we use slices as stacks for context info, but didn't do proper boundary
check when peeking/popping, result in it might panic with using -1 as
slice index in certain cases of calling Write*End without matching
Write*Begin before.

Refactor the code to properly implement the stack, and return a
TProtocolException instead on those cases.

Also add unit tests for all protocols. The unit tests shown that
TCompactProtocol.[Read|Write]StructEnd would also panic with unmatched
Begin calls, so fix them as well.
2020-10-14 10:14:03 -07:00
Yuxuan 'fishy' Wang
daf6209157 THRIFT-5240: Tweak the default go server connectivity check interval
Client: go

This is a follow up to 4db7a0af13.

Because of the Go runtime bug [1], the previous default value of 1ms is
not a great default as it could cause excessive cpu usage. Use 5ms
instead as a balance between being useful and not causing too much cpu
overhead.

It's still configurable.

[1]: https://github.com/golang/go/issues/27707
2020-10-07 22:25:19 -07:00
Jens Geyer
6d570260ca THRIFT-5290 Adjusting cpp *.cproj options according to LEGAL-538
Client: cpp
Patch: Jens Geyer

This closes #2250
2020-10-06 22:17:42 +02:00
David Mollitor
d89b427d19 THRIFT-5287: Log When Client Connections are Dropped
Client: java
Patch: David Mollitor

This closes #2253
2020-10-04 22:18:13 +02:00
Jeffrey Han
5751ddf2ac THRIFT-5286: Fix Lua library readBool() in TCompactProtocol
Client: Lua
Patch: Jeffrey Han

This closes #2252
2020-10-02 22:02:56 +02:00
Stoyan Markov
44b0b5d3c9 THRIFT-5103: Fix for PHP7.4 deprecated syntax
Client: php
Patch: Stoyan Markov

This closes #2230
2020-10-01 23:02:51 +02:00
wangyunjian
fa22f34e74 THRIFT-5256: Fix some compile warnings
Client: c_glib
Patch: wangyunjian

This closes #2207

Signed-off-by: wangyunjian <wangyunjian@huawei.com>
2020-10-01 23:00:11 +02:00
Christopher Chavez
03f01fba18 Fix c_glib implicit function declarations
Client: c_glib
Patch: Christopher Chavez

This closes #2249
2020-10-01 22:43:54 +02:00
Duru Can Celasun
077b5fce82
go: Use sync.Pool for gzip in HTTP transport
b67cad4 introduced transparent gzip support for the HTTP transport but
calling gzip.NewWriter() with every request causes a large number of
memory allocations [1] and can create GC pressure.

Avoid this by using a sync.Pool for gzip writers.

[1] https://old.reddit.com/r/golang/comments/9uejp4/usage_of_syncpool_for_gzipwriter_in_http_handlers/e94jh8c/
2020-09-30 07:25:51 +01:00
zeshuai007
062521f3b6 add the test case into cmake 2020-09-28 14:31:07 +08:00
Yuxuan 'fishy' Wang
6dcd64ee5c THRIFT-5279: Go serializer/deserializer cleanups
Client: go

Cleanup the default NewTSerializer and NewTDeserializer implementations
to save an unnecessary allocation, and provide
NewTSerializerPoolSizeFactory and NewTDeserializerPoolSizeFactory for
easier non-default pool usages.
2020-09-23 09:16:42 -07:00
Yuxuan 'fishy' Wang
a2c44665b4 THRIFT-5278: Allow set protoID in go THeader transport/protocol
Client: go

In Go library code, allow setting the underlying protoID to a
non-default (TCompactProtocol) one for THeaderTransport/THeaderProtocol.
2020-09-22 16:48:38 -07:00
Zezeng Wang
03f4729f7c
Merge pull request #2235 from deiv/fix-abstract-unix-socket-name
Fix abstract unix socket name
2020-09-22 09:35:39 +08:00
David Suárez
4750f361c8 Fix abstract unix socket name
For the abstract unix socket address type, the string in the
'sun_path' field of the 'sockaddr_un' struct, is a not null-terminated
string (see unix(7)).

Fix the lentgh calculation of the 'sun_path' field to not add
the termination null byte.
2020-09-21 11:36:36 +02:00
David Mollitor
e29c39f921 THRIFT-5203: Remove Unused toString Method in TSerializer
Client: cpp
Patch: David Mollitor

This closes #2138
2020-09-20 19:11:39 +02:00