crossbario / crossbario/autobahn-python
missing argument list causes protocol.Error exception in crosserbar.io
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
- the callee registers an RPC function.
- The caller calls the function.
- The function throws an exception in the callee's code.
- The callee responds with ERROR for the INVOCATION, in the error message with no
Arguments|list but only ArgumentsKw|dict. The following error is thrown by the router,
instead of forwarding the ERROR to the CALLER:
Message (after JSON serialization):
"[8,68,1,{},\"custom.error\",{\"message\":\"This error should be thrown\"}]"
crossbar.io's Excpetion (in trace level logging):
crossbar-service_1 | [Router 14 crossbar.router.protocol.WampWebSocketServerProtocol] Traceback (most recent call last):
crossbar-service_1 | File "/usr/local/lib/python3.5/site-packages/autobahn/wamp/websocket.py", line 88, in onMessage
crossbar-service_1 | for msg in self._serializer.unserialize(payload, isBinary):
crossbar-service_1 | File "/usr/local/lib/python3.5/site-packages/autobahn/wamp/serializer.py", line 131, in unserialize
crossbar-service_1 | msg = Klass.parse(raw_msg)
crossbar-service_1 | File "/usr/local/lib/python3.5/site-packages/autobahn/wamp/message.py", line 1036, in parse
crossbar-service_1 | raise ProtocolError("invalid type {0} for 'args' in ERROR".format(type(args)))
crossbar-service_1 | autobahn.wamp.exception.ProtocolError: invalid type <class 'dict'> for 'args' in ERROR
This is against in the recommendation of the standrad's chapter 6.7
"Implementations SHOULD avoid sending empty "Arguments" lists.
E.g. a "CALL" message
[CALL, Request|id, Options|dict, Procedure|uri,
Arguments|list]
where "Arguments == []" SHOULD be avoided, and instead
[CALL, Request|id, Options|dict, Procedure|uri]
SHOULD be sent."
If the empty argument list is sent, the router working properly.
"[8,68,1,{},\"custom.error\",[],{\"message\":\"This error should be thrown\"}]"
This version is harmonize with the standard's chapter 9.2.5, however an example for it could be handy.
The exception looks like come from here: https://github.com/crossbario/autobahn-python/blob/master/autobahn/wamp/message.py#L1134
The code is prepared for the position based argument passing through.
It is a bug in crossbar.io, or the standard is outdated, and ok to send empty argument list, if argument dict is provided?
Thanks for the answer.
br,
Daniel
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with autobahn/wamp/message.py around the referenced line 1134 and reproduce parsing the two serialized ERROR messages shown in the report. Compare the parser behavior with WAMP specification chapters 6.7 and 9.2.5; done means the expected argument-list and argument-dictionary form is established and covered by a regression test or the issue is confirmed as a crossbar.io problem.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100