k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Ctrl-C SIGINT makes k9s to lose state, recently used namespaces

Open den-is opened this issue 4 months ago • 7 comments




Describe the bug Conversation started in https://github.com/derailed/k9s/issues/2560 Ctrl-C SIGINT makes k9s to lose state, recently used namespaces.

To Reproduce

  1. open k9s
  2. navigate to different namespaces, using different methods (e.g. :ns or :po ns), to build "recently used namespaces list"/favorites.
  3. exit k9s with ctrl-c
  4. reopen k9s
  5. observe "recently used namespaces" list is reset - contains only all, default namespaces

Repeat above steps, except on step 3 use :q instead of ctrl-c. In that case, the recently used ns list is preserved between restarts.

Expected behavior Personally, I did not even know/remember about :q and for years used ctrl-c to exit k9s. I hope this is a fixable Signal interception/processing bug in k9s 🙏

Versions (please complete the following information):

  • OS: macos 14.3.1 (same on macos 12)
  • K9s: 0.32.0

den-is avatar Mar 04 '24 05:03 den-is

Hate this, I just upgraded and I used to use CTRL+C to exit out and it always worked, but the latest upgrade keeps clearing everything after I ctrl+c out of it, ugh

peroxy avatar Mar 13 '24 16:03 peroxy

Wow, so this is why k9s has been intolerable to use over the past while. I'm honestly not sure it ever would have occurred to me that ^C was the reason for k9s not remembering the last view between restarts, but yep, confirmed.

jtackaberry avatar Mar 23 '24 23:03 jtackaberry

oh wow!!! hard affected by this!!!

jflambert avatar Apr 19 '24 17:04 jflambert

Yikes! I am baffled by folks expecting a savage SIGINT to entail a gracious exit??

The recommended k9s gracious exit is :q. There is lots of house keeping that k9s performs when exiting. That said, I am responsible for having changed how the configuration are persisted and can sympathies with the mental wiring but in true unix philosophy when a process is brutally interrupted, regarding the OS all bets should be off.

Given the disruption, we will persist the configs on this particular signal, but I am not super keen on enforcing this behavior.

derailed avatar Apr 23 '24 18:04 derailed

I use ctrl+c for top, pg_top, etc. I didn't even know there was a gracious exit command.

jflambert avatar Apr 23 '24 18:04 jflambert

@derailed I'm not sure what you are talking about. I believe you have tons of experience (hence your opinions, and attempts to explain smthing) in IT as well as other guys here and I do. One of the examples, for last few years, all go/rust projects I've been working with (web, grpc, ... some svc) were always implementing signal handling. Before go/rust hypecrap, it always existed in many apps. And of course there were app which were not implementing it too. (if it was a "web" service, they are usually wrapped with something similar to tini).

I'm not sure which other app exits with :q without any other options except VIM-for-noobs ...(but even it has ZZ and ZQ shortcuts)

Ok can we please have shift+z+z ????? :q is annoying to type...

jesus..........

den-is avatar Apr 23 '24 18:04 den-is

SIGKILL is savage, SIGINT is just expedient. :)

Generally speaking I expect console apps to handle SIGINT gracefully and quickly -- flush buffers, release locks, clean up tmp files, etc. -- and not leave a trail of debris in their wake. I truly don't consider ^C to be brutal at all.

jtackaberry avatar Apr 23 '24 18:04 jtackaberry