question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gracefully handle wrong parameter number to WAMP procedures

See original GitHub issue

We should gracefully handle (or allow the app to handle) the situation where a WAMP procedure is called with wrong number of positional arguments:

2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] Traceback (most recent call last):
  File "/home/oberstet/cpy372_7/lib/python3.7/site-packages/autobahn/wamp/websocket.py", line 95, in onMessage
    self._session.onMessage(msg)
  File "/home/oberstet/cpy372_7/lib/python3.7/site-packages/autobahn/wamp/protocol.py", line 939, in onMessage
    on_reply = txaio.as_future(endpoint.fn, *invoke_args, **invoke_kwargs)
  File "/home/oberstet/cpy372_7/lib/python3.7/site-packages/txaio/tx.py", line 428, in as_future
    return ensureDeferred(fun(*args, **kwargs))
TypeError: buy_key() missing 1 required positional argument: 'signature'

2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] dropping connection to peer tcp4:127.0.0.1:8081 with abort=True: I dropped the WebSocket TCP connection: WAMP Internal Error (buy_key() missing 1 required positional argument: 'signature')
2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] session leaving 'wamp.close.transport_lost'
2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] wamp.close.transport_lost: 
2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] >>> Maker session DETACHED from data market (details=CloseDetails(reason=<wamp.close.transport_lost>, message='WAMP transport was lost without closing the session before'))
2019-02-22T15:31:39+0100 [XBRMrktMkr  24056] Stopping factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x7f657992bba8>
2019-02-22T15:31:41+0100 [XBRMrktMkr  24056] connecting once using transport type "websocket" over endpoint "tcp"
2019-02-22T15:31:41+0100 [XBRMrktMkr  24056] Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x7f6575397d68>
2019-02-22T15:31:41+0100 [XBRMrktMkr  24056] >>> Maker session ATTACHED to data market (details=SessionDetails(realm=<realm1>, session=6500367308499916, authid=<HMQY-5EFY-5GEV-LUXM-P3P6-H5VY>, authrole=<xbrmm>, authmethod=anonymous, authprovider=static, authextra={'x_cb_node_id': None, 'x_cb_peer': 'tcp4:127.0.0.1:46350', 'x_cb_pid': 24043}, resumed=None, resumable=None, resume_token=None)) on thread 140074355159168
2019-02-22T15:31:41+0100 [XBRMrktMkr  24056] Registered 8 procedures

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
meejahcommented, May 6, 2019

I can’t repeat the “second failure” above in the interactive session (neither 3.6.3 or 3.7.3):

Python 3.7.3 (default, May  2 2019, 12:54:42)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import txaio

In [2]: txaio.use_twisted()

In [3]: def foo(a, b):
   ...:     return a + b
   ...: 

In [4]: args = [1, 2]

In [5]: txaio.as_future(foo, *args)
Out[5]: <Deferred at 0x7fd23cef9940 current result: 3>

In [6]: args = [1, 2, 3]

In [7]: txaio.as_future(foo, *args)
Out[7]: <Deferred at 0x7fd23cefdda0 current result: <twisted.python.failure.Failure builtins.TypeError: foo() takes 2 positional arguments but 3 were given>>

In [8]: def moo(a, b, details=None):
   ...:     return a + b
   ...: 

In [9]: txaio.as_future(moo, *args)
Out[9]: <Deferred at 0x7fd23ce9ab70 current result: 3>

I also added an integration test-case for this, which also passes … so I’m closing this, unless there’s another way to repeat the problem?

0reactions
meejahcommented, Apr 22, 2019

txaio 18.8.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle the error that occurs on giving wrong number of ...
When i give wrong number of parameters in a function , i get errors. How do I handle it? ... It is not...
Read more >
PHP Error Handling and Logging - Tutorial Republic
PHP Error Handling. In this tutorial you will learn how to use the PHP's error handling functions to deal with the error conditions...
Read more >
Remote Node API — Crossbar.io FX 20.7.2.dev2 documentation
Returns the list of workers currently running on this node. Parameters. filter_types –. Returns. List of worker processes. Return type. list[dict].
Read more >
4. Release Notes — Buildbot 1.1.2 documentation
LDAP bytes/unicode handling has been fixed to work with Python 3. This means that LDAP authentication, REMOTE_USER authentication, and LDAP avatars now work...
Read more >
WAMP Programming — autobahn 22.8.1.dev1 documentation
These components use either Remote Procedure Calls (RPC) or Publish/Subscribe (PubSub) to ... For example, a single WAMP router can manage multiple Realms, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found