Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodetect dying client and implicitly close outstanding requests #17

Closed
wants to merge 6 commits into from

Conversation

matthiasclasen
Copy link
Contributor

We should get told by dbus when a client dies, and could then close any outstanding Request objects.

Matthias Clasen added 6 commits June 27, 2016 23:02
This is in preparation of using the Request type in xdp-utils.h.
This is using the API introduced in the previous commit.
Handle ::sender-died in the same way as a Close() call on
the request: call Close() on the backend and clean up
the Request object.
AppIdData *data;

G_LOCK (app_ids);
data = (AppIdData *)g_hash_table_lookup (app_ids, request->sender);
Copy link
Member

Choose a reason for hiding this comment

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

There is a race here, where the lookup could fail if the sender died and we got removed from the hashtable.

Copy link
Member

Choose a reason for hiding this comment

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

It should perhaps even return FALSE in that case, to handle the fact that we will otherwise miss the client-dying signal.

@matthiasclasen
Copy link
Contributor

I pushed a new attempt at this in the sender-died2 branch

@alexlarsson
Copy link
Member Author

That one looks much better, although it blocks the main thread. See comments i made in the commit there.

@matthiasclasen
Copy link
Contributor

Pushed another version which moves the closing to a thread. It depends on the new-backend-api branch, so needs to wait for that to land first.

@alexlarsson
Copy link
Member Author

@matthiasclasen New sender-died2 branch looks good, please merge.

agx pushed a commit to agx/xdg-desktop-portal that referenced this pull request Dec 20, 2023
whot added a commit to whot/xdg-desktop-portal that referenced this pull request Feb 8, 2024
g_proxy_resolver_get_default() via g_proxy_resolver_gnome_init() fails
hard if the XDG_DATA_DIR isn't set because the GSettings cannot be found:

In particular this statement fails:
   resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);

  (gdb) bt
  #0  0x00007ffff7eb9bef in g_log_structured_array () at /lib64/libglib-2.0.so.0
  flatpak#1  0x00007ffff7eb9edc in g_log_default_handler () at /lib64/libglib-2.0.so.0
  flatpak#2  0x00007ffff7eba180 in g_logv () at /lib64/libglib-2.0.so.0
  flatpak#3  0x00007ffff7eba463 in g_log () at /lib64/libglib-2.0.so.0
  flatpak#4  0x00007ffff7d7b952 in g_settings_set_property () at /lib64/libgio-2.0.so.0
  flatpak#5  0x00007ffff7c4775a in object_set_property () at /lib64/libgobject-2.0.so.0
  flatpak#6  0x00007ffff7c48068 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#7  0x00007ffff7c4a1a3 in g_object_new_valist () at /lib64/libgobject-2.0.so.0
  flatpak#8  0x00007ffff7c4a55f in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#9  0x00007ffff7fb4ac4 in g_proxy_resolver_gnome_init () at /usr/lib64/gio/modules/libgiognomeproxy.so
  flatpak#10 0x00007ffff7c625ea in g_type_create_instance () at /lib64/libgobject-2.0.so.0
  flatpak#11 0x00007ffff7c47fb4 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#12 0x00007ffff7c495d6 in g_object_new_with_properties () at /lib64/libgobject-2.0.so.0
  flatpak#13 0x00007ffff7c4a581 in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#14 0x00007ffff7d03c6c in try_implementation () at /lib64/libgio-2.0.so.0
  flatpak#15 0x00007ffff7d09e8e in _g_io_module_get_default () at /lib64/libgio-2.0.so.0
  flatpak#16 0x00007ffff7d18d2a in g_proxy_resolver_get_default () at /lib64/libgio-2.0.so.0
  flatpak#17 0x00000000004d4083 in proxy_resolver_init (resolver=0x5a6cc0) at ../src/proxy-resolver.c:99

This causes xdp to abort, it never claims the bus and our tests time
out.
whot added a commit to whot/xdg-desktop-portal that referenced this pull request Feb 8, 2024
g_proxy_resolver_get_default() via g_proxy_resolver_gnome_init() fails
hard if the XDG_DATA_DIR isn't set because the GSettings cannot be found:

In particular this statement fails:
   resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);

  (gdb) bt
  #0  0x00007ffff7eb9bef in g_log_structured_array () at /lib64/libglib-2.0.so.0
  flatpak#1  0x00007ffff7eb9edc in g_log_default_handler () at /lib64/libglib-2.0.so.0
  flatpak#2  0x00007ffff7eba180 in g_logv () at /lib64/libglib-2.0.so.0
  flatpak#3  0x00007ffff7eba463 in g_log () at /lib64/libglib-2.0.so.0
  flatpak#4  0x00007ffff7d7b952 in g_settings_set_property () at /lib64/libgio-2.0.so.0
  flatpak#5  0x00007ffff7c4775a in object_set_property () at /lib64/libgobject-2.0.so.0
  flatpak#6  0x00007ffff7c48068 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#7  0x00007ffff7c4a1a3 in g_object_new_valist () at /lib64/libgobject-2.0.so.0
  flatpak#8  0x00007ffff7c4a55f in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#9  0x00007ffff7fb4ac4 in g_proxy_resolver_gnome_init () at /usr/lib64/gio/modules/libgiognomeproxy.so
  flatpak#10 0x00007ffff7c625ea in g_type_create_instance () at /lib64/libgobject-2.0.so.0
  flatpak#11 0x00007ffff7c47fb4 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#12 0x00007ffff7c495d6 in g_object_new_with_properties () at /lib64/libgobject-2.0.so.0
  flatpak#13 0x00007ffff7c4a581 in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#14 0x00007ffff7d03c6c in try_implementation () at /lib64/libgio-2.0.so.0
  flatpak#15 0x00007ffff7d09e8e in _g_io_module_get_default () at /lib64/libgio-2.0.so.0
  flatpak#16 0x00007ffff7d18d2a in g_proxy_resolver_get_default () at /lib64/libgio-2.0.so.0
  flatpak#17 0x00000000004d4083 in proxy_resolver_init (resolver=0x5a6cc0) at ../src/proxy-resolver.c:99

This causes xdp to abort, it never claims the bus and our tests time
out.
whot added a commit to whot/xdg-desktop-portal that referenced this pull request Feb 8, 2024
g_proxy_resolver_get_default() via g_proxy_resolver_gnome_init() fails
hard if the XDG_DATA_DIR isn't set because the GSettings cannot be found:

In particular this statement fails:
   resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);

  (gdb) bt
  #0  0x00007ffff7eb9bef in g_log_structured_array () at /lib64/libglib-2.0.so.0
  flatpak#1  0x00007ffff7eb9edc in g_log_default_handler () at /lib64/libglib-2.0.so.0
  flatpak#2  0x00007ffff7eba180 in g_logv () at /lib64/libglib-2.0.so.0
  flatpak#3  0x00007ffff7eba463 in g_log () at /lib64/libglib-2.0.so.0
  flatpak#4  0x00007ffff7d7b952 in g_settings_set_property () at /lib64/libgio-2.0.so.0
  flatpak#5  0x00007ffff7c4775a in object_set_property () at /lib64/libgobject-2.0.so.0
  flatpak#6  0x00007ffff7c48068 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#7  0x00007ffff7c4a1a3 in g_object_new_valist () at /lib64/libgobject-2.0.so.0
  flatpak#8  0x00007ffff7c4a55f in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#9  0x00007ffff7fb4ac4 in g_proxy_resolver_gnome_init () at /usr/lib64/gio/modules/libgiognomeproxy.so
  flatpak#10 0x00007ffff7c625ea in g_type_create_instance () at /lib64/libgobject-2.0.so.0
  flatpak#11 0x00007ffff7c47fb4 in g_object_new_internal.part () at /lib64/libgobject-2.0.so.0
  flatpak#12 0x00007ffff7c495d6 in g_object_new_with_properties () at /lib64/libgobject-2.0.so.0
  flatpak#13 0x00007ffff7c4a581 in g_object_new () at /lib64/libgobject-2.0.so.0
  flatpak#14 0x00007ffff7d03c6c in try_implementation () at /lib64/libgio-2.0.so.0
  flatpak#15 0x00007ffff7d09e8e in _g_io_module_get_default () at /lib64/libgio-2.0.so.0
  flatpak#16 0x00007ffff7d18d2a in g_proxy_resolver_get_default () at /lib64/libgio-2.0.so.0
  flatpak#17 0x00000000004d4083 in proxy_resolver_init (resolver=0x5a6cc0) at ../src/proxy-resolver.c:99

This causes xdp to abort, it never claims the bus and our tests time
out.
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.

2 participants