# pyROOT possible bug in interaction of XRootD and RDataFrame

**URL:** <https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389>\
**Category:** ROOT\
**Tags:** rdataframe, python\
**Created:** [November 9, 2025, 6:08am UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389 "2025-11-09T06:08:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rquaglia](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rquaglia/32/35548_2.png) [@rquaglia](https://root-forum.cern.ch/u/rquaglia)\
**Post date:** [November 9, 2025, 6:08am UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/1 "2025-11-09T06:08:45Z")

</div>

Dear experts,

I would like to report an issue observed which might or might not be related to some ROOT or XRootD bug in some special use case in python.

Here you can find a reproducer of the issue:

```python
import ROOT as r
from XRootD import client
import fnmatch
import os 
import sys 

def xrootd_glob(xrootd_path):    
    if "///" in xrootd_path :
        raise RuntimeError("Invalid, you have /// too many slashes in the name")
    url = client.URL(xrootd_path)
    # Extract server and path components using XRootD's URL parser
    server = f"{url.protocol}://{url.hostid}"
    path_part = url.path
    # Extract URL parameters (authentication tokens, etc.)
    url_params = url.path_with_params.replace(
        url.path, '', 1) if url.path_with_params != url.path else ""

    try:
        dir_path, pattern = os.path.split(path_part)
    except ValueError:
        raise ValueError(
            "Invalid XRootD path format. Expected: root://server//path/to/dir/*.pattern"
        )
    fs = client.FileSystem(server)
    # Use the directory path with the URL parameters from signed_path
    dir_path_with_params = f"{dir_path}/{url_params}"
    status, listing = fs.dirlist(dir_path_with_params)
    if not status.ok:
        raise RuntimeError(
            f"Failed to list directory {dir_path} on {server}: {status.message}"
        )
    matching_files = [
        f"{server}/{dir_path}/{entry.name}{url_params}" for entry in listing
        if fnmatch.fnmatch(entry.name, pattern)
    ]
    print(f"globbing xrootd : {xrootd_path} returns")
    for _ in matching_files:
        print(f"{_}")
    return matching_files

if __name__ == " __main__":     
    path = "root://eoshome-r.cern.ch//eos/user/r/rquaglia/TupleProcess*.root"
    files = xrootd_glob(path)
    # with no data frame instance it runs
    df = r.RDataFrame("DecayTuple", files)
    h = df.Histo1D("B0_ETA")    
    print(f"entries = {h.GetEntries()}")
    # like this get stucked forever
    
    # it exit execution
    # import os
    # os._exit(0) 
    
    # do not exit execution
    import sys
    sys.exit(0)  

```

The idea of the script is to be able to perform a ‘glob’ of the files over xrootd and then use the returned values to instantiate a RDataFrame. I pointed the example to my own file , but you can adapt to any other file present on something reachable over xrootd.

The observed behaviour is the following :

- making a rdataframe and doing operations and nothing else, leave the execution in a state that prevent the application to exit

- with a os.\_exit(0) it works, with sys.exit(0) it doesn’t

For my code i can add `os._exit(0)` to any application i have, but it would be good to understand the root cause of the problem and if there are guidelines to best use xrootd python module and RDataFrame together. I know there is an open MR to support for xrootd a glob functionality , but it would be good to have a test case combined with RDataFrame.

Thanks in advance ,  
Renato

* * *

Some details of the setup i have on lxplus:

```bash
   ------------------------------------------------------------------
  | Welcome to ROOT 6.36.04 https://root.cern |
  | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Sep 07 2025, 21:26:37 |
  | From tags/6-36-04@6-36-04 |
  | With |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

```

* * *

```auto
bash-5.2$ xrootd -v
v5.8.4

```

* * *

```python
In [4]: from XRootD import client
   ...: 
   ...: # Create a dummy client or check version via module
   ...: print(client. __version__ )
5.8.4

```

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [November 10, 2025, 10:06am UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/2 "2025-11-10T10:06:26Z")

</div>

Thanks for reaching out! I think @vpadulan will take a look when he’ll find time for it (he’s very busy right now)

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [November 12, 2025, 7:02pm UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/3 "2025-11-12T19:02:04Z")

</div>

Dear @rquaglia ,

Thank you for reaching out! And thanks for the reproducer! I don’t have time right now to look into this but I’ll try it. Meanwhile, I wanted to ask a clarification. In your example, if you only write until the `print` statement, with nothing else afterwards, it gets stuck forever? If so, how can it ever move to the next lines with `os._exit` in the case where it’s not stuck?

Cheers,

Vincenzo

---

<div class="post-metadata">

**Author:** ![rquaglia](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rquaglia/32/35548_2.png) [@rquaglia](https://root-forum.cern.ch/u/rquaglia)\
**Post date:** [November 12, 2025, 7:17pm UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/4 "2025-11-12T19:17:01Z")

</div>

Hi @vpadulan , the, event loops and all operations runs and print the output, it is just that the python execution do not manage to exit except if i add the os.\_exit() at the end.  
Hope it vlarify

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [November 12, 2025, 11:01pm UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/5 "2025-11-12T23:01:55Z")

</div>

> [@rquaglia](#):
>
> ```auto
> path = "root://eoshome-r.cern.ch//eos/user/r/rquaglia/TupleProcess*.root"
> files = xrootd_glob(path)
> # with no data frame instance it runs
> df = r.RDataFrame("DecayTuple", files)
> h = df.Histo1D("B0_ETA")    
> print(f"entries = {h.GetEntries()}")
> 
> ```

Ok I see. Can I ask you then to try something else? Could you try putting these lines inside a separate function, then call that function inside the `if name == “ __main__ ”` block? What I’m wondering is if being at the global scope there is some resource which is not well handled and it makes the application hang. Whereas by putting all the code in a separate function the garbage collector should/could be acting more aggressively.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [November 26, 2025, 11:01pm UTC](https://root-forum.cern.ch/t/pyroot-possible-bug-in-interaction-of-xrootd-and-rdataframe/64389/6 "2025-11-26T23:01:56Z")

</div>

Closed on November 26, 2025, 11:01pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
