-
Notifications
You must be signed in to change notification settings - Fork 224
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
Error connecting bus on windows #283
Comments
I think that this indeed works in the libdbus-based applications because they provide autolaunch, which godbus doesn't. Looking at the libdbus source code, this seems to be especially complicated on Windows, using a shared memory region where the dbus server then writes its address after the client launches it. I'd rather avoid adding matching code here since this is specific to libdbus (particularly its server implementation, which is out of scope here) and Windows. Also, for something like this to work, we'd either 1. have to assume that dbus-server is already installed (which most likely isn't the case out of the box for Windows) or 2. bundle it somehow (which isn't sensible IMO). Could you elaborate on your use case? Maybe we can find some other solution to make the address known. |
Sorry for my late reply. We are using dbus on windows to communicate in between two applications. One based on Qt which exposes some functionalities on dbus and one written in go who controls the Qt based application. Currently we start de Qt application which start dbus-deamon then we start the go application. As you said libdbus (used by Qt dbus) is using a Windows shared memory region to share the already running deamon address. The Go application is then not able to find the address and fail to connect to bus. I understand you would not add this shared memory "black magic" in godbus. Is there in this case any way to start dbus-daemon in another way so godbus can connect automatically ? |
How are you coordinating the start of the two applications? Could you make the bus address known to the Go part via some other way? E.g. if the Qt app starts the Go part, you could probably determine determine the address and pass it as an env variable. If there's no way around it, reading the shared memory to find out the bus address as part of the lib on windows is acceptable sounds fine to me. (So connecting to an instance that was autolaunched by a libdbus app would work, but autolaunch from godbus would still not be possible). I don't have that much Windows dev experience, but reading a string from named shmem sounds easy enough to me. |
I start the Qt app first (with autolauch it also start dbus-deamon) and then I start the Go application. |
I am using basic client example on windows and get error such as
Failed to connect to session bus: dbus: couldn't determine address of session bus
. I have also tried to set DBUS_SESSION_BUS_ADDRESS to different values without success.I am able to lauch some Qt or Rust based application including QtDBusViewer and are all working fine (they are all based on libdbus-1)
I have tried the same go example on Linux and it works perfectly.
I don't know if this is relevant dbus is configured to use autolaunch. I have tried with latest dbus 1.13.18 and older precompiled dbus 1.4.1 with same results.
I used a port scanner to find the open port on dbus process and specified manually
DBUS_SESSION_BUS_ADDRESS = "tcp:host=localhost,port=59043,family=ipv4"
and it's working. How can we made godbus to find this automatically ?The text was updated successfully, but these errors were encountered: