Repository navigation
Fix remote file loading intermittently ignored at DataLab startup - #402
Merged
Merged
Conversation
The XML-RPC server was started before the main window was built, so requests could be processed while the window was still being set up: whenever setup code pumped the event loop, a queued command ran on a partially built window. load_from_files and load_from_directory then failed because the History panel did not exist yet, and calls could return before their command was done because readiness signaled by setup code released them. - The server binds its port at startup, but serves requests only once the main window is set up (_after_setup): clients connecting earlier wait instead of being refused. A server still waiting can be shut down. - Remote commands run through run_remote_command, which stores the exception raised by the command before signaling readiness, so that the error is reported to the client instead of being silently ignored. The stored exception is reset at the start of each request. - add_object no longer works around a missing History panel, which existed only because of this startup race. Assisted-by: Claude Opus 5.5
Files loaded with load_from_files and load_from_directory right after connecting to a background DataLab must be loaded when the call returns, without polling. Errors raised by remote commands (calc with an unknown function, set_object with an unknown object) must be reported to the client, and not again by the next command. Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
) - A remote command returning None (e.g. get_current_object_uuid with no current object) returned the result of the previous command instead, such as the panel name returned by call_method: the result is now reset at the start of each request, like the exception. - Closing DataLab while a remote call was waiting for it to be ready (e.g. call_method("close")) hung DataLab: the main window, blocked until the server stopped, could never signal that the request was done. Shutting down the server now releases the waiting call first. Both are covered by new tests, the closing one failing instead of hanging should the deadlock come back. Assisted-by: Claude Opus 5.5
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #398
Remote
load_from_filesandload_from_directorycalls were sometimes silently ignored, or returned before the files were loaded, when sent right after DataLab started. Reproduced on Windows (Python 3.11, PyQt5): 4 to 5 failures out of 10 with the test of the issue.Root cause
The XML-RPC server was started in
_before_setup, before the main window was built. Remote commands are queued signals to the GUI thread: they ran as soon as setup code pumped the event loop (console setup, macro panel,remote_controlledwrappers...), on a partially built window. In instrumented runs, the load slot ran insidesetup()for all 10 early requests:BaseDataPanel.load_from_filesraisedAttributeError: 'NoneType' object has no attribute 'maybe_start_session_for_input': the file was never loaded, and the error never reached the client;SIG_READYemitted by setup code (e.g.handle_autorefresh_action) set the sharedis_readyflag and released the remote call before its command was done.The lead mentioned in the issue (
is_readyshared by all remote calls) is confirmed, but it only explains the early return, not the lost requests.Changes
_after_setup). A client connecting earlier is accepted and gets its first answer once DataLab is ready, instead of being served by a partially built window. A server still waiting can be shut down.DLMainWindow.run_remote_command, which stores the exception raised by the command before signaling readiness (ascall_method_slotalready did). The client gets anxmlrpc.client.Faultinstead of a silent success. The stored exception is reset at the start of each request.add_objectno longer works around a missing History panel: this workaround existed only because of this race.remote_requests_unit_test.py): scenario of the issue for files and directory, checked right after the call without polling; error reporting forcalcwith an unknown function andset_objectwith an unknown object.Behavior changes for remote clients (DataLab
RemoteProxy, SigimaSimpleRemoteProxy)xmlrpc.client.Fault; e.g.calcwith an unknown function used to returnTrue.Validation
_after_setup, and calls returned once the files were loaded.develop(assert 0 == 1: load lost;DID NOT RAISE Fault) and pass on this branch.Out of scope
is_readyremains a single flag shared by all remote calls: once DataLab is started, aSIG_READYemitted by an unrelated GUI action, or by a Web API request, during a pending remote call can still release it early. A per-request synchronization would remove this class of issues.paramargument ofload_from_files/load_from_directory) belongs to the RAW import branch, which should be rebased on this fix.start_webapi_server): every request times out after 30 s #403: when the Web API is started through XML-RPC (start_webapi_server), its main-thread executor is created in the XML-RPC thread, so every Web API request times out after 30 s;calc(XML-RPC or Web API/calc) crashes DataLab (0xC0000005inQMessageBox.critical, called byqt_handle_error_message).