Skip to content

Remote load_from_files / load_from_directory intermittently ignored #398

Closed

Description

@ThomasMalletCodra

Description

When DataLab is controlled remotely (XML-RPC), load_from_files and load_from_directory sometimes return without error while the file is never loaded: no object appears in the target panel, even after waiting several seconds, and no error is reported (neither to the client nor in the DataLab traceback log).

This is not related to the file format or to import parameters: a plain .npy file loaded without any parameter is affected as well.

Steps to reproduce

The following pytest test fails about 2 to 3 times out of 5 on Windows (Python 3.14, PyQt5):

import time

import numpy as np

from datalab.tests import datalab_in_background_context


def test_remote_npy_load(tmp_path) -> None:
    filename = tmp_path / "image.npy"
    np.save(filename, np.arange(6, dtype=np.uint16).reshape(2, 3))
    with datalab_in_background_context() as proxy:
        proxy.set_current_panel("image")
        proxy.load_from_files([str(filename)])
        deadline = time.monotonic() + 10.0
        uuids = proxy.get_object_uuids("image")
        while not uuids and time.monotonic() < deadline:
            time.sleep(0.1)
            uuids = proxy.get_object_uuids("image")
        assert len(uuids) == 1  # intermittently fails: 0 objects

Observed results (5 runs each):

Scenario Failures
RAW file loaded with import parameters, test run alone 3 / 5
Same, after embedded2_unit_test.py 4 / 5
Plain .npy file without parameters, after embedded2_unit_test.py 2 / 5

In one diagnostic run, a first load_from_files call loaded nothing, while a second identical call loaded one object, which suggests that some requests are either lost or processed out of sync with the remote call.

Expected behavior

Each remote load_from_files / load_from_directory call loads the requested files before returning, or reports an error.

Notes

  • No test exercised remote file loading before, which explains why the problem went unnoticed.
  • A possible lead (not verified): RemoteServer.is_ready is a single flag shared by all remote calls (remote_call sets it to False, DLMainWindow.SIG_READY sets it back to True). A late or unrelated SIG_READY could release the waiting call before the main window has processed the request.
  • An end-to-end test for remote RAW import parameters (param argument of load_from_files / load_from_directory) was removed from the RAW import branch because of this instability; it should be restored once this issue is fixed.

Activity

  1. added this to the V1.4.0 milestone on Oct 15, 2026
  2. PierreRaybaut commented on Oct 20, 2026

    @PierreRaybaut
    Contributor

    Fixed by #402, merged into develop (which is why this issue was not closed automatically): remote requests received while DataLab is starting are now processed once its main window is ready, and each remote command reports its own result or error.

    The reproduction test from this issue now passes 10 times out of 10 on develop (5 runs alone, 5 runs after embedded2_unit_test.py), and #402 adds regression tests for load_from_files and load_from_directory called right after startup.

    As noted above, the end-to-end test for remote RAW import parameters can now be restored in #396.

  3. added a commit that references this issue on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions