Comments (1)
I am unable to reproduce this issue as describe. I tried your examples and recreated a unit test.
import rpyc
from rpyc.utils.server import OneShotServer
import unittest
class MyService(rpyc.Service):
def exposed_concat(self, remote_str):
local_str = ' github'
return remote_str + local_str
class Test_OneShotServer(unittest.TestCase):
def setUp(self):
self.server = OneShotServer(MyService, port=18878, auto_register=False)
self.thd = self.server._start_in_thread()
def tearDown(self):
self.server.close()
self.thd.join()
def test_server_stops(self):
conn = rpyc.connect("localhost", port=18878)
self.assertEqual("hello github", conn.root.concat('hello'))
conn.close()
if __name__ == "__main__":
unittest.main()
The output to the above unit test:
Jun 17 16:33:51 DEBUG plumbum.local[MainThread]: Running ['/usr/bin/ssh', '-T', 'localhost', '/bin/sh']
Jun 17 16:33:51 DEBUG plumbum.shell[MainThread]: Running b"true ; echo $? ; echo '--.END1360172845.336028.--' ; echo '--.END1360172845.336028.--' 1>&2"
Jun 17 16:33:51 DEBUG plumbum.shell[MainThread]: 2> b'ssh: connect to host localhost port 22: Connection refused\r\n'
Jun 17 16:33:51 DEBUG plumbum.shell[MainThread]: 1> Nothing returned.
test_server_stops (tests.test_concat.Test_OneShotServer.test_server_stops) ... Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: server started on [0.0.0.0]:18878
Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: accepted ('127.0.0.1', 33746) with fd 5
Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: welcome ('127.0.0.1', 33746)
Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: goodbye ('127.0.0.1', 33746)
Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: listener closed
Jun 17 16:33:51 INFO MY/18878[RpycSpawnThread-builtins.function-93938370855360-139760857434368]: server has terminated
Jun 17 16:33:51 INFO MY/18878[MainThread]: listener closed
ok
----------------------------------------------------------------------
Ran 1 test in 0.038s
OK
My best guess without being given your output is a connectivity issue: something may be preventing the connection (macOs permissions, Windows AV, etc.) or the server was not running (OneShot will serve a single request before shutting down).
Feel free to reopen with more details such as logs/errors, rpyc version, and operating system.
from rpyc.
Related Issues (20)
- using rpyc as build in proxy in app to dispatch message to remote clinet
- How to cancel all the pending requests at the server?
- 5.3.1: sphinx warnings `reference target not found` HOT 2
- 5.3.1: pytest is failing in `tests/test_win32pipes.py::Test_NamedPipe::test_rpyc` unit HOT 6
- server side call client side callback function not work HOT 1
- Documentation on how to start/stop/reload/restart a RPyC service via systemctl services
- Compatibility issue with urllib3
- Allow a Server to expose multiple Services
- rpyc zerodeploy EOF during classic_connect (linux only)
- rpyc not working on py-3.12.1 HOT 4
- Specify a point of contact for security-related issues HOT 1
- ValueError: invalid message type: 18 between Server 5.0.1 and Client 6.0.0 HOT 2
- AttributeError: 'dict' object has no attribute 'shape'
- unix-socket unexpectetly closed by client
- ThreadedServer Signal Handling: Shutting down a server by a remote call accept by service? HOT 4
- 6.0.0: pytest fails in 6 units HOT 2
- Issues with get_id_pack, get_methods, a race and stdin, stdout issues
- Type Annotations / Mypy Support
- Code sometimes freezes when accessing netref objects
- telnetlib has been removed from python standard library, please update docs/docs/howto.rst
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpyc.