! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Proper determination of D-Bus name ownership
Status:
RESOLVED: MOVED
Product:
Xfce4-appfinder
Component:
General

Comments

Description Mario Rugiero 2019-08-01 01:10:24 CEST
This is against git master from a few weeks ago.
If it doesn't apply I'll rebase it, but right now I'm copying directly from a different report as is.
The explanation is also more or less copied.

Take the following situation.
1. For some reason we have the well-known name owned by someone, but this someone doesn't answer connections.
2. We have timeouts, making startup slow.
3. After the timeouts, we try to take ownership of the name, which is probably reasonable.

The way appfinder works now, the following happens:
1. We make a mistake. We use g_dbus_own_name and take its return value as meaningful proof that we're now the owner, when it always returns non-zero and is asynchronous. We have no idea if we own the name until after we run gtk_main_loop.
2. We think we own the name, and thus are the server, so we must not die on close.

This happened in the context of issue #15623.

The attached patch takes care of it by using an explicit message to synchronously ask for ownership and detect whether it was granted.
This way, if a server is running but doesn't answer, the new process realizes it isn't the server itself, so it must die when the window is closed, thus avoiding lingering processes.

This is the original patch, as attached to #15623: https://bugzilla.xfce.org/attachment.cgi?id=8733

I'm not sure if downloading and reattaching is mandatory, but of course will do if asked so.
It just seemed more practical this way.
Comment 1 Git Bot editbugs 2020-05-26 00:56:46 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/xfce4-appfinder/-/issues/17.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #15770

Reported by:
Mario Rugiero
Reported on: 2019-08-01
Last modified on: 2020-05-26

People

Assignee:
Xfce Bug Triage
CC List:
0 users

Version

Version:
Unspecified

Attachments

Additional information