Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Regression with IronPython on RPyC v4.1.0 #337

Closed
pilcru opened this issue Jul 7, 2019 · 1 comment
Closed

Regression with IronPython on RPyC v4.1.0 #337

pilcru opened this issue Jul 7, 2019 · 1 comment
Assignees
Labels
Bug Confirmed bug

Comments

@pilcru
Copy link

pilcru commented Jul 7, 2019

a63c27e re-introduces incompatibilities of RPyC with IronPython that were initially referenced in #10. The issue is that in IronPython, str == unicode, and the CPython side unboxes objects of that type to unicode. This in turns leads to various problems in functions like type() that expect str objects.

A simple fix is to replace this line with:

id_pack = (str(value[0]), value[1], value[2])

to bring back the behavior that was there before. I feel like it's safer to do the cast during unboxing rather than in class_factory, to prevent the id_pack to ever exist as two different types, but that's just a suggestion.

This bug shows up when connecting IronPython 2.7.9 to CPython 2.7.16 on Windows 10 64bits, rpyc v4.1.0.

Server = IronPython:

import rpyc
from rpyc.utils.server import OneShotServer
rpyc.lib.setup_logger()

class ListService(rpyc.Service):
    def exposed_concat(self, lst):
        return [x for x in lst] + ['world']

server = OneShotServer(ListService, port=12345)
server.start()

Client = CPython:

import rpyc
c = rpyc.connect("localhost", 12345)
print(c.root.concat(['hello']))

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 485, in root
    self._remote_root = self.sync_request(consts.HANDLE_GETROOT)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 455, in sync_request
    return self.async_request(handler, *args, timeout=timeout).value
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\async_.py", line 100, in value
    self.wait()
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\async_.py", line 47, in wait
    self._conn.serve(self._ttl)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 384, in serve
    self._dispatch(data)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 352, in _dispatch
    obj = self._unbox(args)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 300, in _unbox
    proxy = self._netref_factory(id_pack)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\protocol.py", line 314, in _netref_factory
    cls = netref.class_factory(id_pack, cls_methods)
  File "C:\Users\pierre\AppData\Local\Continuum\anaconda3\envs\rhinoremote\lib\site-packages\rpyc\core\netref.py", line 302, in class_factory
    return type(name_pack, (BaseNetref,), ns)
TypeError: type() argument 1 must be string, not unicode
@comrumino comrumino self-assigned this Jul 9, 2019
@comrumino comrumino added the To Start Description reviewed and a maintainer needs "to start" triage label Jul 9, 2019
@comrumino
Copy link
Collaborator

Thanks! I'll try to test this moving forward since I now have it configured.

@comrumino comrumino added Bug Confirmed bug and removed To Start Description reviewed and a maintainer needs "to start" triage labels Jul 14, 2019
YuvalEvron pushed a commit to weka/rpyc that referenced this issue Oct 27, 2019
* Added warning to _remote_tb when the major version of local and remote mismatch (tomerfiliba-org#332)

* Added `include_local_version` to DEFAULT_CONFIG to allow for configurable security controls (e.g. `include_local_traceback`)

* Update readme.txt

* Added break to client process loop when everything is dead

* Increased chunk size to improve multi-client response time and throughput of large data tomerfiliba-org#329

* Improved test for response of client 1 while transferring a large amount of data to client 2

* Cleaned up coding style of test_service_pickle.py

* Updated issue template

* added vs code testing cfgs; updated gitignore venv

* Changed settings.json to use env USERNAME

* Name pack casted in _unbox to fix IronPython bug. Fixed tomerfiliba-org#337

* Fixed netref.class_factory id_pack usage per tomerfiliba-org#339 and added test cases

* Added .readthedocs.yml and requirements to build

* Make OneShotServer terminates after client connection ends

* Added unit test for OneShotServer. Fixed tomerfiliba-org#343

* Fixed 2.6 backwards incompatibility for format syntax

* Updated change log and bumped version --- 4.1.1

* Added support for chained connections which result in netref being passed to get_id_pack. Fixed tomerfiliba-org#346

* Added tests for get_id_pack

* Added a test for issue tomerfiliba-org#346

* Corrected the connection used to inspect a netref

* Refactored __cmp__ getattr

* Extended rpyc over rpyc unit testing and removed port parameter from TestRestricted

* Added comment explaining the inspect for intermediate proxy. Fixed tomerfiliba-org#346

* Improved docstring for serve_threaded to address when and when not to use the method. Done tomerfiliba-org#345

* Release 4.1.2

* Fixed versions referred to in security.rst

* link docs instead of mitre

* set up logging with a better formatter

* fix bug when proxy context-manager is being exited with an exception (#1)

* logging: add a rotating file log handler

* fix bug when proxy context-manager is being exited with an exception (#1)

* logging: add a rotating file log handler
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants