https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-breakfast-49010

03/18/2020, 6:26 PM
so if I run
./v2 --enable-pantsd lint src/python/pants/engine::
, I get a rust panic error message printed from an
unwrap
deep within the termion code
and this is making me think that pantsd is somehow trying to run the display code without having access to a terminal
h

hundreds-father-404

03/18/2020, 6:27 PM
Important detail:
./v2
is shorthand for
./pants --no-v1 --v2 --v2-ui
. If you turn off
--v2-ui
, does the error go away?
h

hundreds-breakfast-49010

03/18/2020, 6:28 PM
yeah
I don't think we're using termion at all unless v2-ui is set
đź‘Ť 1
I'm not sure this is even breaking anything, it's just a weird error message
I think it's specifically coming from a thread termion spawns (so it might be a termion bug), but we still probably shouldn't be trying to run any console code in pantsd mode
I'm not 100% sure what is supposed to happen when --enable-pantsd is passed, wrt initializing things in rust
h

hundreds-father-404

03/18/2020, 6:33 PM
but we still probably shouldn’t be trying to run any console code in pantsd mode
What do you mean? For example, you couldn’t run
./v2 repl
with pantsd? I believe pantsd works with V1 repl
h

hundreds-breakfast-49010

03/18/2020, 6:34 PM
I mean, this error looks like it might be coming from the daemon code itself trying to initialize the v2 console data structures
which it shouldn't be trying to do because it's a daemon
but I don't think that many people have tried to run --enable-pantsd and --v2-ui simultaneously, so we might not have run into this before
đź‘Ť 1
my understanidng of how pantsd works is that in python code, if that option is set, we basically fork pants into a persistent daemon, and have the main pants thread run normally
h

hundreds-father-404

03/18/2020, 6:36 PM
but I don’t think that many people have tried to run --enable-pantsd and --v2-ui simultaneously, so we might not have run into this before
Agreed
w

witty-crayon-22786

03/18/2020, 7:15 PM
yea. under
pantsd
, pants attempts to redirect stdout/stderr to filehandles that are copied to the socket. it also attempts to clone/redirect a TTY temporarily.
depending on when the termion code is initialized, it might not be observing the TTY
h

hundreds-breakfast-49010

03/18/2020, 7:19 PM
ah yeah, the termion code gets initialized when we call
Session::new()
in rust
so by that time I assume the existing pantsd code has already done whatever TTY manipulation it does
so probably we just want to make sure that
should_render_ui
is false for pantsd
w

witty-crayon-22786

03/18/2020, 7:20 PM
not necessarily. it creates a TTY per connection
... oh. but
Session::new
...? hm.
the daemon itself has sessions that it uses for things.
h

hundreds-breakfast-49010

03/18/2020, 7:21 PM
yeah that's where the v2 UI code lives, which was probably not written to work with with whatever the pantsd tty code is doing
I'm still digging into the pantsd code myself right now
w

witty-crayon-22786

03/18/2020, 7:23 PM
i think the question would be: "which" session is this?
and rather than panicing at the line you're seeing, trying to turn it into a python-level error instead might clarify
h

hundreds-breakfast-49010

03/18/2020, 7:24 PM
I think the error is actually coming from a thread that termion code spawns. it doesn't seem to break any functionality, it just prints out a confusing error message on the screen
I'm running
./v2 --enable-pantsd lint src/python/pants/engine::
and I see an error message whose backtrace never leaves termion code
so I think tihs is is coming from the thread that termion's
async_stdin
spawns to read stdin without blocking
Copy code
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 6, kind: Other, message: "No such device or address" }', /home/gregs/.cache/pants/rust/cargo/registry/src/github.com-1ecc6299db9ec823/termion-1.5.5/src/async.rs:43:36
w

witty-crayon-22786

03/18/2020, 7:27 PM
sounds plausible.