Closed dmadisetti closed 1 year ago
I can't reproduce this. Could you give more details?
I started game, and ran the following script while in the main menu. I then loaded up a save game, quit to main menu, then loaded a different save game, and the script continued to work. I also tried pausing while in flight view.
import krpc
import time
c = krpc.connect()
while True:
print(c.krpc.get_status())
time.sleep(0.5)
Try stopping this script, loading a save, then rerunning the script.
import krpc
import matplotlib.pyplot as plt
from time import sleep
print(krpc.__version__)
conn = krpc.connect()
print(conn.krpc.get_status())
vessel = conn.space_center2.active_vessel
print("eccentricity", vessel.orbit.eccentricity)
Rerunning the script in the same load seems to be fine, but stopping the script and rerunning leaves us hanging at actually querying values. Interrupting gives the following trace:
0.5.2
version: "1.0.0"
bytes_read: 55531
bytes_written: 69248
bytes_read_rate: 149.379227
bytes_written_rate: 31578.6543
rpcs_executed: 1284
rpc_rate: 3.72065544
max_time_per_update: 1000
adaptive_rate_control: true
blocking_recv: true
recv_timeout: 1000
time_per_rpc_update: 0.0011580314
poll_time_per_rpc_update: 0.000800466223
exec_time_per_rpc_update: 0.000266010436
time_per_stream_update: 2.81823377e-05
^CTraceback (most recent call last):
File "/home/dylan/src/kerbal/script.py", line 9, in <module>
print("eccentricity", vessel.orbit.eccentricity)
File "<string>", line 1, in <lambda>
File "/home/dylan/src/kerbal/kerbal/lib/python3.10/site-packages/krpc/client.py", line 195, in _invoke
response = cast(KRPC.Response, self._rpc_connection.receive_message(KRPC.Response))
File "/home/dylan/src/kerbal/kerbal/lib/python3.10/site-packages/krpc/connection.py", line 38, in receive_message
data += self.partial_receive(1)
File "/home/dylan/src/kerbal/kerbal/lib/python3.10/site-packages/krpc/connection.py", line 77, in partial_receive
ready = select.select([self._socket], [], [], timeout)
Confirmed, can reproduce. Will look into it.
This is due to the server not correctly restarting when loading a new save. The remote object cache isn't getting cleared, leading to null reference exceptions when a new save is loaded.
Related to #13
Behavior: Loading a save file after the first time causes the client to hang.
Expected Behavior: Client should start new connection with the current running instance.
Maybe this has something to do with pausing and starting? Either way, manual testing is needing a total restart of the game.