autobahn-python icon indicating copy to clipboard operation
autobahn-python copied to clipboard

Protocol Error: PUBLISHED received for non-pending request ID

Open Mdrbhatti opened this issue 8 years ago • 2 comments

I am using a wampcc router, with Autobahn|Python clients. They work completely fine, until I try to publish a message from one of the Python clients.

I have the following setup: 1 WAMPCC router 1 Autobahn|Python publish client 1 Autobahn|Python subscribe client

You can also find the code of my minimal setup here: https://gist.github.com/Mdrbhatti/6926a1c9bfba780573c92bea1982ddec

This is the error I get when I try to run publish.py

publish: com.myapp.topic1 0
2018-08-07T10:54:26 Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\autobahn\wamp\websocket.py", line 95, in onMessage
    self._session.onMessage(msg)
  File "C:\Python37\lib\site-packages\autobahn\wamp\protocol.py", line 701, in onMessage
    raise ProtocolError("PUBLISHED received for non-pending request ID {0}".format(msg.request))
autobahn.wamp.exception.ProtocolError: PUBLISHED received for non-pending request ID 1

2018-08-07T10:54:26 session closed with reason wamp.close.transport_lost [WAMP transport was lost without closing the session before]
publish: com.myapp.topic1 1
2018-08-07T10:54:27 Task exception was never retrieved
future: <Task finished coro=<Component.onJoin() done, defined at publish.py:38> exception=TransportLost()>
Traceback (most recent call last):
  File "publish.py", line 42, in onJoin
    self.publish(u'com.myapp.topic1', counter)
  File "C:\Python37\lib\site-packages\autobahn\wamp\protocol.py", line 1289, in publish
    raise exception.TransportLost()
autobahn.wamp.exception.TransportLost

Currently. the wampcc router is sending a PUBLISHED ack message for every PUBLISH it receives. I cannot find anything in the wamp-proto RFC that requires the session to be closed on receiving an unwanted PUBLISHED message. For more context: darrenjs/wampcc#40

I have also tried AutobahnC++ with a wampcc router, and I had no errors or issues with publishing/subscribing to it. I was able to fix this error by passing the options parameter in the publish method:

self.publish(u'com.myapp.topic1', counter, options=PublishOptions(acknowledge=True))

Mdrbhatti avatar Aug 07 '18 09:08 Mdrbhatti

Currently. the wampcc router is sending a PUBLISHED ack message for every PUBLISH it receives. I cannot find anything in the wamp-proto RFC that requires the session to be closed on receiving an unwanted PUBLISHED message.

Sending an unsolicited PUBLISHED message is a WAMP protocol error, and conforming WAMP peers MUST close the connection.

Up till recently, the spec required a hard drop of the connection - that has been relaxed: https://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#protocol_errors

I have also tried AutobahnC++ with a wampcc router, and I had no errors or issues with publishing/subscribing to it.

That's a bug in AutobahnC++: it should behave similar to AutobahnPython.

I was able to fix this error by passing the options parameter in the publish method:

This is not a fix, but a workaround for the bug in wampcc ..

self.publish(u'com.myapp.topic1', counter, options=PublishOptions(acknowledge=True))

-- Tobias Oberstein - phone +49 176 2375 2055 - [email protected] Crossbar.io GmbH - Waldstrasse 18 - 91054 Erlangen HRB 15870 - Amtsgericht Fuerth - Geschäftsfuehrer/CEO - Tobias Oberstein

http://crossbario.com

oberstet avatar Aug 07 '18 10:08 oberstet

That's a bug in AutobahnC++: it should behave similar to AutobahnPython.

Ah, I incorrectly assumed that this behavior of AutobahnC++ was confirming to the WAMP protocol... Thanks for clearing it up!

This is not a fix, but a workaround for the bug in wampcc ..

Agreed.

Mdrbhatti avatar Aug 07 '18 10:08 Mdrbhatti