Skip to content

Delivering complex objects to the remote fails if the remote cannot unpickle them #7

Description

@pilcru

For example, trying to deliver a (remote) numpy array. Probably this does not even make sense: we shouldn't deliver something that is already on the remote. Similarly, sending b"a" from IronPython 2 to CPython 2 won't work because it represents a call to bytes(u'a', 'latin-1') in IronPython, that CPython has no chance of understanding since bytes == str, which only takes one argument (no encoding).

But maybe this might hint at other issues when passing around netrefs or function calls.

>>> np = sc.sticky['numpy']
>>> rpyc.utils.classic.deliver(rpy, np.array(10))

Runtime error (Exception): TypeError
Traceback:
  line 516, in sync_request, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\protocol.py"
  line 78, in syncreq, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
  line 212, in __call__, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
  line 292, in deliver, "C:\Users\pcuvil.WIN\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\utils\classic.py"
  line 58, in script

--- Remote traceback: ---
Exception caught
Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 342, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 638, in _handle_call
    return obj(*args, **dict(kwargs))
TypeError: ('loads() argument 1 must be string, not unicode', <built-in function loads>, (u"cnumpy.core.multiarray\n_rec
onstruct\np1\n(cnumpy\nndarray\np2\n(I0\ntS'b'\ntRp3\n(I1\n(tcnumpy\ndtype\np4\n(S'i4'\nI0\nI1\ntRp5\n(I3\nS'<'\nNNNI-1\
nI-1\nI0\ntbI00\nS'\\n\\x00\\x00\\x00'\ntb.",))
>>> rpyc.utils.classic.deliver(rpy, b"a")
(Same local traceback)

--- Remote traceback ---
Exception caught
Traceback (most recent call last):
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 342, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "c:\tools\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 638, in _handle_call
    return obj(*args, **dict(kwargs))
TypeError: ('str() takes at most 1 argument (2 given)', <type 'str'>, (u's', u'latin-1'))

Forcing casting to bytes in rpyc.utils.classic.obtain or rpyc.core.netref.__array__ doesn't fix it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions