Print

Print


Original made a git issue scikit-hep/uproot4#224 with uproot as i thought it could be uproot and xrootd clashing but after discussing with Jim Pivarksi at uproot, he determined simply calling glob was putting XRootD into a state which determines where it hangs or not and it was not related uproot.

Jim created a minimally reproducible example with 8 test cases (see code below). The only two test cases which hang is when using glob from XRootD.client.glob_funcs and either using ProcessPoolExecutor or multiprocessing.

ProcessPoolExecutor ThreadPoolExecutor multiprocessing threading
XRootD.client.glob_funcs.glob 🚫 (hangs) ✅ 🚫 (hangs) ✅
no glob ✅ ✅ ✅ ✅
import XRootD.client
from concurrent import futures
import threading
import multiprocessing
from XRootD.client.glob_funcs import glob

def simple_func(input_path, tree):
    file = XRootD.client.File()
    status, _ = file.open(input_data[0])
    print(status)

    status, some_raw_bytes = file.read(0, 100)
    print(status)
    print(some_raw_bytes)

    status, some_raw_bytes = file.read(100, 200)
    print(status)
    print(some_raw_bytes)

    return "yay"

# Call it and forget about it.
glob("root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleMuParked.root")

input_data = ["root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleMuParked.root"]
tree = 'Events'

which_test = "multiprocessing"

if which_test == "ProcessPoolExecutor":
    with futures.ProcessPoolExecutor(max_workers=1) as executor:
        future = executor.submit(simple_func, input_data[0], tree)
        print(future.result())

elif which_test == "ThreadPoolExecutor":
    with futures.ThreadPoolExecutor(max_workers=1) as executor:
        future = executor.submit(simple_func, input_data[0], tree)
        print(future.result())

elif which_test == "multiprocessing":
    class MyProcess(multiprocessing.Process):
        def run(self):
            print("before")
            print(simple_func(input_data[0], tree))
            print("after")
    myprocess = MyProcess()
    myprocess.start()
    myprocess.join()

else:
    class MyThread(threading.Thread):
        def run(self):
            print("before")
            print(simple_func(input_data[0], tree))
            print("after")
    mythread = MyThread()
    mythread.start()
    mythread.join()

Tested with versions:

python==3.8.5
xrootd===5.0.3-


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/issues/1405", "url": "https://github.com/xrootd/xrootd/issues/1405", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1