Skip to content

Ft/0.21.0#23

Closed
ggmaleva wants to merge 131 commits intomasterfrom
ft/0.21.0
Closed

Ft/0.21.0#23
ggmaleva wants to merge 131 commits intomasterfrom
ft/0.21.0

Conversation

@ggmaleva
Copy link
Copy Markdown

No description provided.

Jens-G and others added 30 commits February 4, 2024 14:50
Client: go

Implement slog.LogValuer for all TStruct and TException generated by the
compiler for go code. Also add SlogTStructWrapper in the library so we
don't have to repeat it in the compiler generated go code.
This is tested with apache#2927, which
published to https://test.pypi.org/project/thrift-test/. I tested
locally with:

    (venv) fishy@penguin:~/work/test$ pip install -i https://test.pypi.org/simple/ thrift-test
    Looking in indexes: https://test.pypi.org/simple/
    Collecting thrift-test
      Downloading https://test-files.pythonhosted.org/packages/e6/02/5885ea1406f560d0a23351f68acc2892d7f6495b16bfc2eeee8de4649777/thrift-test-0.21.0.tar.gz (62 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.3/62.3 kB 1.4 MB/s eta 0:00:00
      Preparing metadata (setup.py) ... done
    Collecting six>=1.7.2 (from thrift-test)
      Downloading https://test-files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz (29 kB)
      Preparing metadata (setup.py) ... done
    Building wheels for collected packages: thrift-test, six
      Building wheel for thrift-test (setup.py) ... done
      Created wheel for thrift-test: filename=thrift_test-0.21.0-cp311-cp311-linux_x86_64.whl size=416914 sha256=3a972bc562be7ed19cb37399e444ed0d373cde5319023974080b625e550901d4
      Stored in directory: /home/fishy/.cache/pip/wheels/45/20/1f/d3e1b869ac068d63ca2b2c13a2f4e33a80b360fae7091c8a9b
      Building wheel for six (setup.py) ... done
      Created wheel for six: filename=six-1.10.0-py2.py3-none-any.whl size=9942 sha256=74014380446ccf331366316cec0b1aaf40e0162e70307622b493e38e8451115f
      Stored in directory: /home/fishy/.cache/pip/wheels/e4/18/d0/e02474c90dcf14c511c0f52145d7e72e41ff3fb80b330ba58e
    Successfully built thrift-test six
    Installing collected packages: six, thrift-test
    Successfully installed six-1.10.0 thrift-test-0.21.0
    (venv) fishy@penguin:~/work/test$ python3
    Python 3.11.7 (main, Dec  8 2023, 14:22:46) [GCC 13.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from thrift.transport import TSocket
    >>> transport = TSocket.TSocket('localhost', 9090)
    >>> transport
    <thrift.transport.TSocket.TSocket object at 0x785b18d83690>
    >>> transport.open()
    Could not connect to any of [('::1', 9090, 0, 0), ('127.0.0.1', 9090)]
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/fishy/work/test/venv/lib/python3.11/site-packages/thrift/transport/TSocket.py", line 149, in open
        raise TTransportException(type=TTransportException.NOT_OPEN, message=msg)
    thrift.transport.TTransport.TTransportException: Could not connect to any of [('::1', 9090, 0, 0), ('127.0.0.1', 9090)]
    >>> from thrift.protocol import fastbinary
    >>> fastbinary
    <module 'thrift.protocol.fastbinary' from '/home/fishy/work/test/venv/lib/python3.11/site-packages/thrift/protocol/fastbinary.cpython-311-x86_64-linux-gnu.so'>
    >>> fastbinary.decode_compact
    <built-in function decode_compact>
    >>>

If we want to merge this version, I'll enable pending publishing with
`pypi.yml` from this repo on pypi [1].

[1]: https://pypi.org/manage/account/publishing/
Fix the test to expect `typeId` and `class` inside the `type` object
instead of on the root level.
This is the way the compiler generates is.

Old output:
```json
  "constants": [
    {
      "name": "myNumberz",
      "typeId": "enum",
      "type": {
        "typeId": "enum",
        "class": "Numberz"
      },
      "value": 1
    }
  ],
```
New output:
```
  "constants": [
    {
      "name": "myNumberz",
      "typeId": "enum",
      "class": "Numberz",
      "value": 1
    }
  ],
```
Co-authored-by: Pavel Kvach <pavel.kvach@gmail.com>
Co-authored-by: Pavel Kvach <pavel.kvach@gmail.com>
Co-authored-by: Pavel Kvach <pavel.kvach@gmail.com>
This PR fixes the Security tests to build on a clean install of ubuntu
20.04 and ubuntu 22.04 without modifications to the systems openssl
configuration.

 * Enable TLS 1.0 and TLS 1.1 on OpenSSL 1.1 with the seclevel=0 flag
 * Disable TLS 1.0 and TLS 1.1 on OpenSSL 3.0

While its technically possible to enable it on OpenSSL 3 I think because
of all the issues with these old TLS versions dropping support for it is
better.

This PR builds forth on the work done here: apache#2811

Tested with the ubuntu 20.04 (OpenSSL 1.1) and 22.04 (OpenSSL 3.0) docker containers.
All lib/cpp tests succeed in both.
Some libraries want to bypass the TServer class and handle the full
service startup manually. For example when building a service that hosts
multiple thrift services where the IFace type is unknown when handling a
request.

For example when you host multiple services on top of netty and through
an HTTP path you want to route to the correct thrift service. In this
situation you treat can treat an IFace as an Object and use the
`getProcessMapView()` method to parse a byte array into a thrift message
and pass let the `AsyncProcessFunction` handle the invocation.

To return a correct thrift response it's necessary to write the
`{service_name}_result` that contains the response args.
While it is possible to get an incoming args object from the
(Async)ProcessFunction its unfortunately not possible to get
a result object without using reflection.

This PR extends the (Async)ProcessFunction by adding a
`getEmptyResultInstance` method that returns a new generic `A` (answer)
that matches the `{service_name}_result` object.

This allows thrift users to write the following processing code:
```java
<I> void handleRequest(
        TProtocol in,
        TProtocol out,
        TBaseAsyncProcessor<I> processor,
        I asyncIface
) throws TException {
    final Map<String, AsyncProcessFunction<Object, TBase<?, ?>, TBase<?, ?>, TBase<?, ?>>> processMap = (Map) processor.getProcessMapView();
    final var msg = in.readMessageBegin();
    final var fn = processMap.get(msg.name);

    final var args = fn.getEmptyArgsInstance();
    args.read(in);
    in.readMessageEnd();

    if (fn.isOneway()) {
        return;
    }

    fn.start(asyncIface, args, new AsyncMethodCallback<>() {
        @OverRide
        public void onComplete(TBase<?, ?> o) {
            try {
                out.writeMessageBegin(new TMessage(fn.getMethodName(), TMessageType.REPLY, msg.getSeqid()));
                final var response_result = fn.getEmptyResultInstance();
                final var success_field = response_result.fieldForId(SUCCESS_ID);
                ((TBase) response_result).setFieldValue(success_field, o);
                response_result.write(out);
                out.writeMessageEnd();
                out.getTransport().flush();
            } catch (TException e) {
                throw new RuntimeException(e);
            }
        }

        @OverRide
        public void onError(Exception e) {
            try {
                out.writeMessageBegin(new TMessage(fn.getMethodName(), TMessageType.EXCEPTION, msg.getSeqid()));
                ((TApplicationException) e).write(out);
                out.writeMessageEnd();
                out.getTransport().flush();
            } catch (TException ex) {
                throw new RuntimeException(ex);
            }
        }
    });
}
```
The above example code doesn't need any reference to the original types
and can dynamically create the correct objects to return a correct
response.
Client: Delphi
Patch: Jens Geyer
…ory allocations when using COM types

Client: Delphi
Patch: JensG
Both the default constructor and operator== implementations reference
certain member functions of the class' members. As an example, the default
constructor references (i.e., "uses") the default constructors of its
members.

If a class contains a std::vector<Foo>, and Foo has only been *forward*-
declared (which happens often in Thrift-generated code), this creates
undefined behavior: The std::vector specification states that as long as
Foo is an incomplete type, it is fine to reference std::vector<Foo>, but
not any members (such as its default constructor).

Thus, we must defer our default constructor's implementation (which references
the default constructor of std::vector<Foo>) to a point where Foo is a
complete type. That is the case in the .cpp file.

The same holds for operator==.
This makes sure that helper structs like _args and _result also have
their default constructors defined.
Yuxuan 'fishy' Wang and others added 28 commits August 14, 2024 17:42
Fix Java compilation issues introduced by THRIFT-4847 in d4503a1
Also fix the failing spotlessCheck

---------

Co-authored-by: Mario Emmenlauer <mario@emmenlauer.de>
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
…ache#3015)

* Bump com.ncorti.ktfmt.gradle from 0.12.0 to 0.19.0 in /lib/kotlin

Bumps com.ncorti.ktfmt.gradle from 0.12.0 to 0.19.0.

---
updated-dependencies:
- dependency-name: com.ncorti.ktfmt.gradle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix formatting for updated ktfmt

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
Bumps [jvm](https://github.com/JetBrains/kotlin) from 1.9.23 to 2.0.10.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](JetBrains/kotlin@v1.9.23...v2.0.10)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [com.bmuschko:gradle-clover-plugin](https://github.com/bmuschko/gradle-clover-plugin) from 2.2.1 to 3.0.3.
- [Release notes](https://github.com/bmuschko/gradle-clover-plugin/releases)
- [Changelog](https://github.com/bmuschko/gradle-clover-plugin/blob/master/RELEASE_NOTES.md)
- [Commits](bmuschko/gradle-clover-plugin@v2.2.1...3.0.3)

---
updated-dependencies:
- dependency-name: com.bmuschko:gradle-clover-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Client: go

This was a bug introduced by 91565d4
that broke go's cross-test server, but because other CI issues we didn't
run cross-test so we didn't notice the issue.
There were some recent changes causing six to be installed on the `make
install` step instead of (implicitly) on the `Python setup` step before,
and the six installed on `make install` step was not available to the
next `make check` step and causing errors.

Install six on `Python setup` step explicitly instead.
args not optional type hint

UUID generator support

Remove runtime type check
- Update flag description to be more precise
- No implict enum generation (gen enum flag required)
- Use latest thrift test IDL for uuid coverage
- rebase on latest main
Review: document explicit int enum generation requirement instead of implicit

Co-authored-by: r/Salomon Smeke <134332337+salomon-smekecohen@users.noreply.github.com>
Build and test the netstd library so there is some basic testing.
Run tests on ubuntu-22.04, as 20.04 wil be EoL soon and also had some issues with dotnet-sdk.
Compare output of printTo() with known expected strings.

Also fix some whitespacing, while at the files.
patch taken from Jira issue, with permission of author (github-user @jvoosten)
* add missing include of "sstream" (seen when building with msvc)
* remove deprecated boost header

  While compiling ThrifttReadCheckTests.cpp I found this warning:
  /usr/include/boost/test/auto_unit_test.hpp:17:1: note: ‘#pragma message: This header is deprecated. Use <boost/test/unit_test.hpp> instead.’
     17 | BOOST_HEADER_DEPRECATED( "<boost/test/unit_test.hpp>" )
        | ^~~~~~~~~~~~~~~~~~~~~~~

  As this goes back to boost v1.34.0 (released in May 2007) we can switch the headerfile, without risking build errors.
With THRIFT-5109 the LIB_INSTALL_DIR for MSVC libs chanaged from lib/
to bin/ which makes sense for shared libs but is not consistent with the
usual treatment of static libs.
Install the static libs to lib/, similar to other platforms and projects.
Bumps [jvm](https://github.com/JetBrains/kotlin) from 2.0.10 to 2.0.20.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](JetBrains/kotlin@v2.0.10...v2.0.20)

---
updated-dependencies:
- dependency-name: jvm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@ggmaleva ggmaleva closed this Mar 27, 2026
@ggmaleva ggmaleva deleted the ft/0.21.0 branch March 27, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.