jpochyla / psst

Fast and multi-platform Spotify client with native GUI
MIT License
8.55k stars 218 forks source link

Signal SIGXCPU on Linux when I build it myself #539

Closed Fruitsalad closed 1 month ago

Fruitsalad commented 1 month ago

Describe the bug After compiling the program myself, I get a SIGXCPU signal (CPU time limit exceeded) whenever I try to play a track. The program then crashes. This did not happen when I used a prebuilt binary.

To Reproduce I presume this does not happen on your device, which makes it rather difficult to reproduce. I simply ran:

sudo apt-get install libssl-dev libgtk-3-dev libcairo2-dev libasound2-dev
cargo build
cargo run --bin psst-gui

Of course that makes the process seem a bit cleaner than it really was since at first I missed out on the apt-get install step. Nevertheless I don't believe I did anything particularly out of the ordinary, and after properly ensuring all packages are installed (only libssl-dev wasn't already installed) a cargo clean && cargo run --bin psst-gui yields the same results.

Environment

Fruitsalad commented 1 month ago

This issue isn't very important to me by the way, but I thought it was good to make record of it.

SO9010 commented 1 month ago

Heya, I'm pretty sure that this happens as a protection for your computer not to crash, so only the program crashes. This is because you are only building the "developer" build, add --release after your command, then it will remove this issue ;)

So try: cargo run --bin psst-gui --release

jacksongoode commented 1 month ago

This is still a little bit weird that this happens. I don't know exactly what the resolution here is.

SO9010 commented 1 month ago

Ah ok so I have been looking through documentation, I think the way to fix this is through checking your current CPU time limit:

ulimit -t

Then you can set it to unlimited though this:

ulimit -t unlimited

This may be wrong I haven't tested it yet.

SO9010 commented 1 month ago

No this isn't the answer, mine is already set to unlimited... wierd!

Fruitsalad commented 1 month ago

I tried a couple of things just now:

  1. Release builds work just fine for me. No problems at all.
  2. All of the following commands give "unlimited" for me:
    ulimit -R
    ulimit -SR
    ulimit -HR
    ulimit -t
    ulimit -St
    ulimit -Ht
  3. I also injected the following bit of code into psst-gui (specifically route_widget()):
    let realtime_limit = rlimit::getrlimit(Resource::RTTIME).unwrap();
    let cputime_limit = rlimit::getrlimit(Resource::CPU).unwrap();
    println!("Realtime: {realtime_limit:?}");
    println!("CPU time: {cputime_limit:?}");

    In a debug build this gives:

    Realtime: (18446744073709551615, 18446744073709551615)
    CPU time: (18446744073709551615, 18446744073709551615)

    Where 18446744073709551615 is 2**64 - 1 (presumably unlimited).

I honestly don't think this bug is viable to fix without a kernel developer butting in. If you want to close this as wontfix that would be fine by me.

SO9010 commented 1 month ago

Thank you so much for your help!

SO9010 commented 1 month ago

@jacksongoode should we close this now, I do want to note that building with these optimisations does make it take a bit longer to build.

jacksongoode commented 1 month ago

I think it's ok to close, if this needs to be reopened if someone wants to figure out more optimal dev settings I believe that's fine.