Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Signals not delivered/event not raised on client proxy #8

Closed
oskarb opened this issue Nov 15, 2010 · 4 comments
Closed

Signals not delivered/event not raised on client proxy #8

oskarb opened this issue Nov 15, 2010 · 4 comments

Comments

@oskarb
Copy link

oskarb commented Nov 15, 2010

dbus-sharp 0.7 does not correctly raise an event in the client proxy when a signal occurs. This is a regression compared to NDesk.Dbus 0.6.

This can be tested with TestExportInterface.cs from the examples folder.

The sample has server and client in the same code. First process started will be the server. The output from the second invocation, the client, is this:

( I modifed MatchRule.cs (Equals() and GetHashCode() to output the ToString() of the MatchRule. The guid is unique for each MatchRule instance.)

dbus-sharp-0.7.0/examples @ DBUS_VERBOSE=1 mono ./TestExportInterface.exe
Matchrule(09de57d3-3b42-4314-9772-987b9ff66cee): type='signal',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameAcquired',sender='org.freedesktop.DBus'
Warning: No signal handler for NameAcquired
Bad! Generating fallback reader for SimplePresence
Bad! Generating fallback reader for IDemoOne
Bad! Generating fallback reader for IDemoOne

Matchrule(4a636600-f6a5-4d06-8d71-d58f4b0cc7da): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender='org.ndesk.test'
Matchrule(4a636600-f6a5-4d06-8d71-d58f4b0cc7da): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender='org.ndesk.test'
Matchrule(da2f2167-0f4a-42cd-90fb-d406614908a5): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Warning: No signal handler for SomeEvent

[[ Comment: This should be triggered by demo.FireOffSomeEvent (); on line 37. The event handler was attached on line 36, but is not called. Note how the sender field in the MatchRule differs between the defined MatchRule, and the incomning one, preventing the proper match from occuring. ]]

Matchrule(cf6e9db6-6df6-4cf4-8bc0-ef2a29bb957d): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(0d381ab4-b24b-498b-b61c-3e555cac3388): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Warning: No signal handler for SomeEvent

Matchrule(b9e1994e-c183-48cb-b78f-ec21473b748e): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(b9e1994e-c183-48cb-b78f-ec21473b748e): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(030a019a-f1e3-475e-ae78-3f6aef861809): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
this Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
that Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(030a019a-f1e3-475e-ae78-3f6aef861809): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
this Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
that Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(030a019a-f1e3-475e-ae78-3f6aef861809): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
this Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
that Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
Matchrule(27a0ad97-c0f3-4eef-b728-166fb7cba465): type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
this Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
that Matchrule: type='signal',path='/org/ndesk/test',interface='org.ndesk.test',member='SomeEvent',sender=':1.113'
SomeEvent handler: some string, 21, 19.84, a, b
SomeEvent handler two: some string, 21, 19.84, a, b

[[ Comment: This should be triggered from line 46, the two event handlers attached on line 44 and 45. So now it works. And indeed, the sender field is the same for all MatchRules involved in this segment of the code. ]]

[[ Rest of output snipped. ]]

So it appears that the problem relates to the sender field of MatchRule, but I don't know if it is initially set incorrect, or if MatchRule is too picky. What also seems to happen is that after the first method call, the sender field in the defined MatchRule is different, enabling the event to be raised properly.

So in summary:
If an event handler is attached directly after GetObject(), it will never be called due to mismatching sender in MatchRule. But if you first call a method on the client proxy, and only after that attach the event handler, the sender field in the defined MatchRule will be the same as the one generated for the incoming event. Apart from the example code mentioned above, I have confirmed this workaround in my application, which broke after upgrade from NDesk.Dbus 0.6.

@ikabot
Copy link

ikabot commented Nov 30, 2010

I can confirm the issue. I have my code working perfectly with 0.6 and when I updated to 0.7 I didn't get any event.
I have downgrade to 0.6 for now.

@garuma
Copy link
Contributor

garuma commented Dec 10, 2010

Heya, sorry for the long reaction time but your problem should be fixed with the workaround in 608328b

Could you confirm?

@oskarb
Copy link
Author

oskarb commented Jan 28, 2011

The issue is not fixed. Just tested master branch (latest commit c162856). Now none of the event handlers are triggered, so the problem is actually worse.

@garuma
Copy link
Contributor

garuma commented Feb 10, 2011

Committed additional fix to master, it now works on my side

bl8 pushed a commit to bl8/dbus-sharp that referenced this issue Sep 28, 2013
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants