Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Jython support broken #171

Closed
ericfrederich opened this issue Jun 25, 2015 · 9 comments
Closed

Jython support broken #171

ericfrederich opened this issue Jun 25, 2015 · 9 comments

Comments

@ericfrederich
Copy link

Since pull request #166 Jython support is broken.
Using rpyc to get two different Python implementations talking to each other is extremely useful.
The ability to use rpyc to call from CPython into Java libraries is awesome... It'd be great to get it working again.

Here is the server and client output.

# SERVER
#
user@host:~/dev/rpyc/ $> JYTHONPATH=../plumbum ../jython/dist/bin/jython ./bin/rpyc_classic.py 
INFO:SLAVE/18812:server started on [0.0.0.0]:18812
INFO:SLAVE/18812:accepted 127.0.0.1:33661
INFO:SLAVE/18812:welcome [127.0.0.1]:33661
INFO:SLAVE/18812:goodbye [127.0.0.1]:33661
ERROR:SLAVE/18812:client connection terminated abruptly
Traceback (most recent call last):
  File "__pyclasspath__/rpyc/utils/server.py", line 172, in _authenticate_and_serve_client
    self._serve_client(sock2, credentials)
  File "__pyclasspath__/rpyc/utils/server.py", line 197, in _serve_client
    conn._init_service()
  File "__pyclasspath__/rpyc/core/protocol.py", line 162, in _init_service
    self._local_root.on_connect()
  File "__pyclasspath__/rpyc/core/service.py", line 145, in on_connect
    self._conn.modules = ModuleNamespace(self._conn.root.getmodule)
  File "__pyclasspath__/rpyc/core/protocol.py", line 512, in root
    self._remote_root = self.sync_request(consts.HANDLE_GETROOT)
  File "__pyclasspath__/rpyc/core/protocol.py", line 458, in sync_request
    self._send_request(seq, handler, args)
  File "__pyclasspath__/rpyc/core/protocol.py", line 254, in _send_request
    self._send(consts.MSG_REQUEST, seq, (handler, self._box(args)))
  File "__pyclasspath__/rpyc/core/protocol.py", line 244, in _send
    gc.disable()
NotImplementedError: can't disable Java GC
Exception in thread Thread-2:Traceback (most recent call last):
  File "/home/user/dev/jython/dist/Lib/threading.py", line 222, in _Thread__bootstrap
    self.run()
  File "/home/user/dev/jython/dist/Lib/threading.py", line 213, in run
    self._target(*self._args, **self._kwargs)
  File "__pyclasspath__/rpyc/utils/server.py", line 172, in _authenticate_and_serve_client
    self._serve_client(sock2, credentials)
  File "__pyclasspath__/rpyc/utils/server.py", line 197, in _serve_client
    conn._init_service()
  File "__pyclasspath__/rpyc/core/protocol.py", line 162, in _init_service
    self._local_root.on_connect()
  File "__pyclasspath__/rpyc/core/service.py", line 145, in on_connect
    self._conn.modules = ModuleNamespace(self._conn.root.getmodule)
  File "__pyclasspath__/rpyc/core/protocol.py", line 512, in root
    self._remote_root = self.sync_request(consts.HANDLE_GETROOT)
  File "__pyclasspath__/rpyc/core/protocol.py", line 458, in sync_request
    self._send_request(seq, handler, args)
  File "__pyclasspath__/rpyc/core/protocol.py", line 254, in _send_request
    self._send(consts.MSG_REQUEST, seq, (handler, self._box(args)))
  File "__pyclasspath__/rpyc/core/protocol.py", line 244, in _send
    gc.disable()
NotImplementedError: can't disable Java GC
user@host:~/dev/rpyc/ $> 


#
# CLIENT
#
user@host:~/dev/rpyc/ $> python
Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpyc
>>> rpyc.classic.connect('localhost')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "rpyc/utils/classic.py", line 68, in connect
    return factory.connect(host, port, SlaveService, ipv6 = ipv6, keepalive = keepalive)
  File "rpyc/utils/factory.py", line 91, in connect
    return connect_stream(s, service, config)
  File "rpyc/utils/factory.py", line 52, in connect_stream
    return connect_channel(Channel(stream), service = service, config = config)
  File "rpyc/utils/factory.py", line 41, in connect_channel
    return Connection(service, channel, config = config)
  File "rpyc/core/protocol.py", line 157, in __init__
    self._init_service()
  File "rpyc/core/protocol.py", line 162, in _init_service
    self._local_root.on_connect()
  File "rpyc/core/service.py", line 145, in on_connect
    self._conn.modules = ModuleNamespace(self._conn.root.getmodule)
  File "rpyc/core/protocol.py", line 512, in root
    self._remote_root = self.sync_request(consts.HANDLE_GETROOT)
  File "rpyc/core/protocol.py", line 470, in sync_request
    self.serve(remaining_time)
  File "rpyc/core/protocol.py", line 408, in serve
    data = self._recv(timeout, wait_for_lock = True)
  File "rpyc/core/protocol.py", line 366, in _recv
    data = self._channel.recv()
  File "rpyc/core/channel.py", line 50, in recv
    header = self.stream.read(self.FRAME_HEADER.size)
  File "rpyc/core/stream.py", line 209, in read
    raise EOFError("connection closed by peer")
EOFError: connection closed by peer
>>> 
user@host:~/dev/rpyc/ $> 
@ericfrederich
Copy link
Author

Any plans on fixing this? Again, I think it is extremely useful to use rpyc on the same machine to get CPython and Jython working together.

coldfix added a commit that referenced this issue Jul 4, 2017
@coldfix coldfix closed this as completed in 9ae608e Jul 4, 2017
@coldfix
Copy link
Contributor

coldfix commented Jul 4, 2017

Hi,

should be fixed on current master. Sorry for the "slight" delay. If you're still using this package and experience any trouble, give me a shout-out. Thanks for pointing out the problem.

Best, Thomas

@conradek
Copy link

When using 3.4.2, I still see the original issue posted by ericfrederich.

From the server:

Exception in thread Thread-1:Traceback (most recent call last):
File "/home/cek/jython/Lib/threading.py", line 222, in _Thread__bootstrap
self.run()
File "/home/cek/jython/Lib/threading.py", line 213, in run
self._target(*self._args, **self._kwargs)
File "/home/cek/jython/Lib/site-packages/rpyc/utils/server.py", line 172, in _authenticate_and_serve_client
self._serve_client(sock2, credentials)
File "/home/cek/jython/Lib/site-packages/rpyc/utils/server.py", line 198, in _serve_client
self._handle_connection(conn)
File "/home/cek/jython/Lib/site-packages/rpyc/utils/server.py", line 204, in _handle_connection
conn.serve_all()
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 423, in serve_all
self.serve(0.1)
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 423, in serve_all
self.serve(0.1)
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 415, in serve
self._dispatch(data)
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 383, in _dispatch
self._dispatch_request(seq, args)
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 343, in _dispatch_request
self._send_reply(seq, res)
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 258, in _send_reply
self._send(consts.MSG_REPLY, seq, self._box(obj))
File "/home/cek/jython/Lib/site-packages/rpyc/core/protocol.py", line 245, in _send
gc.disable()
NotImplementedError: can't disable Java GC

Any ideas? Thanks!

@coldfix
Copy link
Contributor

coldfix commented Jul 25, 2017

That's because the patch is only on master, not in the release so far. I'll create a new release tomorrow.

Best, Thomas

@conradek
Copy link

Ok, thanks!

coldfix added a commit that referenced this issue Jul 26, 2017
- Add missing endpoints config in ThreadPoolServer (#222)
- Fix jython support (#156,#171)
- Improve documentation (#158,#185,#189,#198 and more)
@coldfix
Copy link
Contributor

coldfix commented Jul 26, 2017

Done. Give me a call if you still have problems.

@conradek
Copy link

I have confirmed that this is fixed in 3.4.3. Thanks!

@ericfrederich
Copy link
Author

Thanks, I'm doing different things now and don't have an immediate need to use Java libraries from CPython.
I may give it a try in my free time just because I think it's a cool idea.

@ericfrederich
Copy link
Author

I guess now that this is fixed it would make sense to add other Python implementations (jython, pypy) to tox/travis or whatever is running the unit tests here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants