root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.71k stars 1.29k forks source link

TTree Scan function on windows platform, using vscode to connect wsl connection jupyter reported a deadlock. #14076

Closed Esword618 closed 11 months ago

Esword618 commented 1 year ago

Check duplicate issues.

Description

On windows, when vscode is used to connect pyroot's jupyter of wsl subsystem, pyroot's TTree Sacn function is stuck. Other jupyter lab in wsl do not have this situation. Why is this, is there any solution? Note that vscode is used to connect to jupyter lab in wsl.

Reproducer

from ctypes import c_double, c_int
from ROOT import TFile, TTree,TCanvas
guan = TFile("guan.root", "recreate")

ming = TTree("ming", "This is my first tree")
i = c_int(1)
a = c_double(2.2)
b = c_double(0.0)

ming.Branch("i", i, "i/I")
ming.Branch("a", a, "a/D")
ming.Branch("b", a, "b/D")

for j in range(100):
    i = j
    a = i * 0.1
    b = a * a * 9
    ming.Fill()

ming.Write()
# BUG
ming.Scan()

ROOT version

root_v6.30.01.Linux-ubuntu22-x86_64-gcc11.4

Installation method

build

Operating system

wls and ubuntu22.04

Additional context

No response

guitargeek commented 1 year ago

Hi! What happens when you do Write() at the end, and not before Scan()? Usually the write should happen only after interacting with the object, so maybe that's worth to try out. Otherwise I have no idea.

Esword618 commented 1 year ago

The "write" function is normal, and the "scan" function is abnormal.

guitargeek commented 1 year ago

Yes I understand that, but is the Scan() still abnormal if you don't do the Write() before?

Esword618 commented 1 year ago

The same is true when I read a root file, which is independent of the "Write" function.

guitargeek commented 1 year ago

Ok, then I think we can't help you without a reproducer. The only Windows user I know in the ROOT team is @bellenot, so I assigned the PR to him.

bellenot commented 11 months ago

On windows, when vscode is used to connect pyroot's jupyter of wsl subsystem

Can you describe exactly how you connect from VS Code to PyRoot's Jupyter in WSL?

bellenot commented 11 months ago

OK, I managed to set-up an environment. Here is what I get with your example and root_v6.30.02.Linux-ubuntu22-x86_64-gcc11.4:

Welcome to JupyROOT 6.30/02
************************************************
*    Row   *       i.i *       a.a *       b.b *
************************************************
*        0 *         1 *       2.2 *       2.2 *
*        1 *         1 *       2.2 *       2.2 *
*        2 *         1 *       2.2 *       2.2 *
*        3 *         1 *       2.2 *       2.2 *
*        4 *         1 *       2.2 *       2.2 *
*        5 *         1 *       2.2 *       2.2 *
*        6 *         1 *       2.2 *       2.2 *
*        7 *         1 *       2.2 *       2.2 *
*        8 *         1 *       2.2 *       2.2 *
*        9 *         1 *       2.2 *       2.2 *
*       10 *         1 *       2.2 *       2.2 *
*       11 *         1 *       2.2 *       2.2 *
*       12 *         1 *       2.2 *       2.2 *
*       13 *         1 *       2.2 *       2.2 *
*       14 *         1 *       2.2 *       2.2 *
*       15 *         1 *       2.2 *       2.2 *
*       16 *         1 *       2.2 *       2.2 *
*       17 *         1 *       2.2 *       2.2 *
*       18 *         1 *       2.2 *       2.2 *
*       19 *         1 *       2.2 *       2.2 *
*       20 *         1 *       2.2 *       2.2 *
...
*       33 *         1 *       2.2 *       2.2 *
*       34 *         1 *       2.2 *       2.2 *
*       35 *         1 *       2.2 *       2.2 *
*       36 *         1 *       2.2 *       2.2 *
*       37 *         1 *       2.2 *    
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Type <CR> to continue or q to quit ==> Type <CR> to continue or q to quit ==> Type <CR> to continue or q to quit ==> Type <CR> to continue or q to quit ==>

And then, if I type again ming.Scan() in a new cell I got the same output...

Esword618 commented 11 months ago

My data volume is relatively large, and the one-time output of the Scan function is limited. I guess this is the reason. This uses jupyter lab for code editing in the browser, and using the Scan function is not a problem. Mainly in vscode, I use vscode to connect to the local wsl subsystem and use vscode's jupyter editor. Will this know the reason for the jupyter in vscode itself?

bellenot commented 11 months ago

Mainly in vscode, I use vscode to connect to the local wsl subsystem and use vscode's jupyter editor.

Same here.

Will this know the reason for the jupyter in vscode itself?

What do you mean? I tried your example and it works just fine...

pcanal commented 11 months ago

Type to continue or q to quit ==>

This is the potential source of the problem (i.e. Scan waiting for user input). To disable this feature use:

tree->SetScanField(0);
Esword618 commented 11 months ago

okk,thanks.

bellenot commented 11 months ago

OK, then I close this issue

github-actions[bot] commented 11 months ago

Hi @bellenot,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot: