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.
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.
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
Client: php
Patch: Das Dedipyaman
This closes#2245
Update field access for getters_setters flag. FFields are private if getters_setters are set, otherwise, public.
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.
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.
Generated python files have a blank line at the end of files, except for
service files where there are two blank lines, this change makes these
service files consistent.
This change is trivial and thus does not require a ticket.
Client: lua
Patch: longzhiri <persistentsnail@gmail.com>
This closes#2212
The oneway method's processor has no need to write the result to client, but it is necessary to return values of each handler's return.
Client: go
Starting from go 1.15, go test starts to complain about wrongly used int
to string conversions:
./field.go:58:83: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./numeric.go:72:12: conversion from int64 to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./json_protocol_test.go:612:92: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
./simple_json_protocol_test.go:685:96: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
json_protocol_test and simple_json_protocol_test usages are actually
already in format arg so just remove the conversion is good enough.
field is no longer used anywhere so just removed it (there's one line of
commented out code in compact_protocol so remove that line as well). The
one in numeric.go is actually a bug. We didn't set sValue correctly in
NewNumericFromI64 and NewNumericFromI32 functions.
Client: py
This is inspired by changes to the Go library (THRIFT-5214) and, by
proxy, this blog post[1]. The idea is that if the other end of the
socket has closed their end of the connection, we can figure that out by
doing a non-blocking read on our socket before we waste time serializing
and sending a message just to find out the socket is closed when we try
to read the response.
[1]: https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/
Client: go
In previous implementation of socket connectivity check, we try to read
1 byte and put it into buffer when succeeded. The buffer complicates
the implementation of Read function. Change to use syscall.Recvfrom with
MSG_PEEK flag instead so that the buffer is no longer needed.
Client: go
In the current implementation, we only call endOfFrame when we hit EOF
when reading from the frameReader. The problem is in go stdlib the Read
call finished reading the remaining data from frameReader will not
return EOF, the next Read will. This caused us in most cases only call
endOfFrame at the beginning of the next frame, which could cause
troubles because we didn't read the beginning of the frame properly.