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

[OMEMO] new device is not shown on other clients as bundle is published after #127

Open
matthewrfennell opened this issue Jul 28, 2024 · 2 comments

Comments

@matthewrfennell
Copy link

I noticed a case where a new device does not show on other clients. I found this on Psi+ 1.4.554 with OMEMO Plugin v0.0.1.

When you log in for the first time, with the OMEMO Plugin enabled, Psi+ publishes the new device to the devicelist before publishing the device's bundle.

This starts a race condition with the other client. If the other client queries the bundle for that device ID first, then it gets item-not-found back and the new device doesn't show on the other client.

Do you think it is feasible to publish the bundle before publishing the new device to the devicelist?

I'm happy to work on a PR for this if needed.

cc: @stigger - rion suggested I mention this to you

Scenario

Psi+ publishes the new device ID 63303797

Jul 28 09:03:49 c2s56499afb0610	debug	RECV: <iq xml:lang='en' id='aac5a' type='set'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='eu.siacs.conversations.axolotl.devicelist'>
	 <item>
	  <list xmlns='eu.siacs.conversations.axolotl'>
	   <device id='498942155'/>
	   <device id='621016301'/>
	   <device id='568763013'/>
	   <device id='63303797'/>
	  </list>
	 </item>
	</publish>
	</pubsub></iq>

This new device gets forwarded to Monal

Jul 28 09:03:50 c2s56499b03f3e0	debug	SEND: <message to='[email protected]/Monal-iOS.5d964763' id='YcNe8jQoR71C9Fe7Lx3KDnga' from='[email protected]' type='headline'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='eu.siacs.conversations.axolotl.devicelist'><item id='abd44f5e-7b99-4ee9-a72e-29f0f25269c5' publisher='[email protected]'>
	  <list xmlns='eu.siacs.conversations.axolotl'>
	   <device id='498942155'/>
	   <device id='621016301'/>
	   <device id='568763013'/>
	   <device id='63303797'/>
	  </list>
	 </item></items></event></message>

Monal requests the bundle for this new device

Jul 28 09:03:50 c2s56499b5c7e00	debug	RECV: <iq xml:lang='en' type='get' id='B0E1D4E3-ED32-4B7D-8ABB-D72B640AF2D5' to='[email protected]'><pubsub xmlns='http://jabber.org/protocol/pubsub'><items node='eu.siacs.conversations.axolotl.bundles:63303797'/></pubsub></iq>

Prosody returns item-not-found as the bundle hasn't been published yet

Jul 28 09:03:50 c2s56499b5c7e00	debug	SEND: <iq type='error' id='B0E1D4E3-ED32-4B7D-8ABB-D72B640AF2D5' to='[email protected]/Monal-iOS.85f7311a' from='[email protected]'><error type='cancel'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>

Psi+ publishes the bundle

Jul 28 09:03:50 c2s56499afb0610	debug	RECV: <iq xml:lang='en' id='aac6a' type='set'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='eu.siacs.conversations.axolotl.bundles:63303797'>
	 <item>
	  <bundle xmlns='eu.siacs.conversations.axolotl'>
	   ...
	  </bundle>
	 </item>
	</publish>
	</pubsub></iq>
@stigger
Copy link
Member

stigger commented Jul 28, 2024

Do you think it is feasible to publish the bundle before publishing the new device to the devicelist?
I'm happy to work on a PR for this if needed.

Thanks for the investigation. The proposed solution seems reasonable to me, so if you could also implement a fix, that would be great.

@matthewrfennell
Copy link
Author

matthewrfennell commented Jul 28, 2024

The proposed solution seems reasonable to me, so if you could also implement a fix, that would be great.

Thanks. My employer makes me get approval for each open source project I contribute to - I'll raise the request and will hopefully be able to raise a PR in a few weeks.

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

No branches or pull requests

2 participants