Skip to content

GH-50302: [GLib][Ruby][FlightRPC] Add missing references for GC#50401

Open
kou wants to merge 1 commit into
apache:mainfrom
kou:glib-flight-listen-gc
Open

GH-50302: [GLib][Ruby][FlightRPC] Add missing references for GC#50401
kou wants to merge 1 commit into
apache:mainfrom
kou:glib-flight-listen-gc

Conversation

@kou

@kou kou commented Jul 7, 2026

Copy link
Copy Markdown
Member

Rationale for this change

gaflight_server_listen() may use options' auth handler later. So we should refer the given options while the server is alive. If we don't refer the given options, we may touch freed auth handler later.

The argument of ArrowFlight::Criteria.new/ArrowFlight::Ticket.new should be referred to protect from GC in Ruby.

What changes are included in this PR?

  • Refer options for gaflight_server_listen()
  • Refer expression for ArrowFlight::Criteria.new
  • Refer data for ArrowFlight::Ticket.new

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

Copilot AI review requested due to automatic review settings July 7, 2026 00:49
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #50302 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GLib Arrow Flight server binding to retain a reference to the GAFlightServerOptions passed to gaflight_server_listen(), preventing the options (and indirectly the auth handler object graph) from being freed while the server is still alive.

Changes:

  • Store GAFlightServerOptions* in GAFlightServerPrivate and keep it referenced across the server lifetime.
  • Add a dispose implementation to release the stored options reference when the server object is torn down.
  • Update gaflight_server_listen() to replace the stored options reference on each listen.

Comment thread c_glib/arrow-flight-glib/server.cpp Outdated
Comment on lines +1254 to +1259
auto priv = GAFLIGHT_SERVER_GET_PRIVATE(server);
if (priv->options) {
g_object_unref(priv->options);
}
priv->options = options;
g_object_ref(priv->options);
@kou kou force-pushed the glib-flight-listen-gc branch from 3b0771c to 3df3a78 Compare July 7, 2026 01:03
Copilot AI review requested due to automatic review settings July 7, 2026 01:24
@kou kou force-pushed the glib-flight-listen-gc branch from 3df3a78 to 8f41f6b Compare July 7, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +1205 to +1208
if (priv->options) {
g_object_unref(priv->options);
priv->options = nullptr;
}
Comment on lines +1254 to +1261
auto priv = GAFLIGHT_SERVER_GET_PRIVATE(server);
if (priv->options != options) {
g_object_ref(priv->options);
if (priv->options) {
g_object_unref(priv->options);
}
priv->options = options;
}
@kou kou force-pushed the glib-flight-listen-gc branch from 8f41f6b to 853822b Compare July 7, 2026 01:36
Copilot AI review requested due to automatic review settings July 7, 2026 01:45
@kou kou force-pushed the glib-flight-listen-gc branch from 853822b to 8239181 Compare July 7, 2026 01:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +1205 to +1209
if (priv->options) {
g_object_unref(priv->options);
priv->options = nullptr;
}

Comment on lines 136 to 139
macos:
name: ARM64 macOS GLib & Ruby
runs-on: macos-latest
runs-on: macos-26
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
@kou kou force-pushed the glib-flight-listen-gc branch from 8239181 to df02f37 Compare July 7, 2026 04:44
@kou kou changed the title GH-50302: [GLib][FlightRPC] Add a missing options reference for gaflight_server_listen() GH-50302: [GLib][Ruby][FlightRPC] Add missing references for GC Jul 7, 2026
Copilot AI review requested due to automatic review settings July 7, 2026 06:10
@kou kou force-pushed the glib-flight-listen-gc branch from df02f37 to 632f010 Compare July 7, 2026 06:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment on lines +1203 to +1208
auto priv = GAFLIGHT_SERVER_GET_PRIVATE(object);

if (priv->options) {
g_object_unref(priv->options);
priv->options = nullptr;
}
Comment thread ci/scripts/c_glib_test.sh Outdated
Comment on lines +39 to +45
env | sort

run_test_args=()
if [ -n "${RUNNER_DEBUG}" ]; then
run_test_args+=(-v)
fi
ruby test/run-test.rb "${run_test_args[@]}"
Comment on lines 136 to 139
macos:
name: ARM64 macOS GLib & Ruby
runs-on: macos-latest
runs-on: macos-26
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
@kou kou force-pushed the glib-flight-listen-gc branch 2 times, most recently from eab1c4a to e5960c4 Compare July 7, 2026 06:52
Copilot AI review requested due to automatic review settings July 7, 2026 06:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

… `gaflight_server_listen()`

`gaflight_server_listen()` may use options' auth handler later. So we
should refer the given options while the server is alive.
@kou kou force-pushed the glib-flight-listen-gc branch from e5960c4 to 1306697 Compare July 7, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants