MongooseIM icon indicating copy to clipboard operation
MongooseIM copied to clipboard

Error Temporary Subscriptions xep-0060.html#impl-tempsub

Open vkatsuba opened this issue 6 years ago • 4 comments

MongooseIM version: 3.3.0 Installed from: https://github.com/esl/MongooseIM/tree/3.3.0 Erlang/OTP version: 20

Hi All,

When I try create XML as described for https://xmpp.org/extensions/xep-0060.html#impl-tempsub and send this XML:

<iq type='set'
    from='tester2@localhost'
    to='pubsub.localhost'
    id='lease3'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscribe node='test_channel' jid='tester2@localhost'/>
    <options node='test_channel' jid='tester2@localhost'>
        <x xmlns='jabber:x:data' type='submit'>
          <field var='FORM_TYPE' type='hidden'>
            <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
          </field>
          <field var='pubsub#expire'><value>2019-10-31T17:36:49.559220Z</value></field>
        </x>
     </options>
  </pubsub>
</iq>

I get error:

18:04:48.342 [error] event=pubsub_crash,details=#{action => subscribe_node,class => throw,event => dirty_failed,node_name => <<"test_channel">>,pubsub_host => <<"pubsub.localhost">>,reason => {error,{invalid_ejson,{1572,543409,559220}}},stacktrace => [{jiffy,encode,2,[{file,"/home/vk/git-repo/mongooseim/_build/default/lib/jiffy/src/jiffy.erl"},{line,99}]},{mod_pubsub_db_rdbms,add_subscription,5,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/pubsub/mod_pubsub_db_rdbms.erl"},{line,476}]},{node_flat,subscribe_node,8,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/pubsub/node_flat.erl"},{line,183}]},{mod_pubsub,node_call,4,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/pubsub/mod_pubsub.erl"},{line,4255}]},{mod_pubsub,'-db_call_fun/3-fun-0-',3,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/pubsub/mod_pubsub.erl"},{line,4313}]},{mod_pubsub_db,'-extra_debug_fun/1-fun-0-',1,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/pubsub/mod_pubsub_db.erl"},{line,191}]},{mongoose_rdbms,sql_dirty_internal,2,[{file,"/home/vk/git-repo/mongooseim/_build/prod/lib/mongooseim/src/rdbms/mongoose_rdbms.erl"},{line,609}]},{mongoose_rdbms,run_sql_cmd,4,[{file,"/home/vk/mongooseim/_build/prod/lib/mongooseim/src/rdbms/mongoose_rdbms.erl"},{line,490}]}

Looks like the error provided from https://github.com/esl/MongooseIM/blob/3.3.0/src/pubsub/mod_pubsub_db_rdbms.erl#L487 As I see the value what was set to jiffy:encode/1 is [{expire,{1572,543409,559220}}], full code looks like:

...
EncodedOpts = jiffy:encode({[{expire,{1572,543409,559220}}]}),
...

Looks like is expected jiffy:encode({[{expire,1566309677755494}]}) instead of jiffy:encode({[{expire,{1572,543409,559220}}]}) or something similar with a suitable structure. If you can, please take a look to this issue. Many thanks for your time.

P.S. When I set 1566309677755494 looks like the xep-0060.html#impl-tempsub still not working as expected, but maybe expected other data format.

Regards, --V

vkatsuba avatar Oct 31 '19 16:10 vkatsuba

Hi All,

Also looks like second part of xep-0060.html#impl-tempsub about configuration node by owner also not supported. I don't get any error but I don't see the behavior as described in xep-0060.html#impl-tempsub. When I try set XML lile:

<iq type='set'
    from='tester@localhost'
    to='pubsub.localhost'
    id='configtemp'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
    <configure node='test_channel'>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='FORM_TYPE' type='hidden'>
          <value>http://jabber.org/protocol/pubsub#node_config</value>
        </field>
        <field var='pubsub#tempsub'><value>true</value></field>
      </x>
    </configure>
  </pubsub>
</iq>

And user subscribe to channel then go to offline, the server provided presence type unavailable however user still subscribed. Not sure that this is refers to the problem that I described above but in the course of the https://xmpp.org/extensions/xep-0060.html#impl-tempsub investigation, such behavior was revealed. Maybe it’s just not supported yet on MongooseIM, but I not sure. If not supported yet - please, confirm it.

Regards, --V

vkatsuba avatar Oct 31 '19 17:10 vkatsuba

Hi All,

Any updates?

Regards, --V

vkatsuba avatar Nov 26 '19 08:11 vkatsuba

Hi @vkatsuba

I've added this report to our internal backlog, however I'm not sure when it will be resolved yet.

fen-pl avatar Dec 02 '19 18:12 fen-pl

Hi @fenek,

Many thanks for feedback. For this case I will add custom hook as a temporary solution.

Regards, --V

vkatsuba avatar Dec 02 '19 18:12 vkatsuba