andrewrk / poop

Performance Optimizer Observation Platform
MIT License
788 stars 50 forks source link

reached unreachable code (in VM) #31

Open peterwaller-arm opened 1 year ago

peterwaller-arm commented 1 year ago

I just tried running this in a VM where the counters are unavailable and got the following output:

$ ./poop echo
poop [1/1] 'echo'... thread 305373 panic: reached unreachable code
Unable to dump stack trace: debug info stripped
Aborted (core dumped)

I was hoping I might use some functionality of the program even if counters are unavailable. I am making an assumption that the problem is caused by the lack of counters; in an attempt to learn more detail, I was unable to build this using zig 0.10 on nix, I got an error about std.Build not being defined.

Avokadoen commented 1 year ago

You probably want to use the master branch when building Also, does ./poop --help work? Seems like you are missing command arguments

peterwaller-arm commented 1 year ago

You probably want to use the master branch when building Also, does ./poop --help work? Seems like you are missing command arguments

Sorry -- I have edited it in situ (previously read ./poop without echo, I must have dropped it accidentally). I wasn't able to quickly get my hands on the master branch (of either zig nor poop), but hoped this information may nonetheless be useful even if it's just for a binary taken from the github releases.

kassane commented 1 year ago

In docker (non-privileged) CI/CD, try running:

root@083728cd359b:/data# ./zig-out/bin/poop 'ls' 'ls -lh'
thread 8 panic: unable to open perf event: PermissionDenied

/home/kassane/zig/0.12.0-dev.17+49244dc0c/files/lib/std/io/fixed_buffer_stream.zig:0:13: 0x27f152 in panicExtra__anon_6850 (poop)
/home/kassane/zig/0.12.0-dev.17+49244dc0c/files/lib/std/debug.zig:347:15: 0x27df75 in panic__anon_4569 (poop)
/home/kassane/Documentos/poop/src/main.zig:203:36: 0x2226c3 in main (poop)
/home/kassane/zig/0.12.0-dev.17+49244dc0c/files/lib/std/start.zig:574:37: 0x218777 in posixCallMainAndExit (poop)
/home/kassane/zig/0.12.0-dev.17+49244dc0c/files/lib/std/start.zig:243:5: 0x2181b1 in _start (poop)
???:?:?: 0x2 in ??? (???)
Unwind information for `???:0x2` was not available, trace may be incomplete

Aborted (core dumped)

maybe, needs capabilities?

kassane commented 1 year ago

maybe, needs capabilities?

For me works (locally) using --cap-add CAP_PERFMON in docker run.

updated

peterwaller-arm commented 1 year ago

I think I'm hitting https://github.com/andrewrk/poop/issues/17#issuecomment-1675113084 which is that there is nothing I can do from within a VM (or at least one which doesn't support the counters) to make that syscall work.

I might have hoped either: