Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish_key_reader keeps running in background at 100%, ignoring SIGHUP #9309

Closed
floam opened this issue Oct 27, 2022 · 1 comment
Closed

fish_key_reader keeps running in background at 100%, ignoring SIGHUP #9309

floam opened this issue Oct 27, 2022 · 1 comment
Labels
bug Something that's not working as intended
Milestone

Comments

@floam
Copy link
Member

floam commented Oct 27, 2022

If you launch fish_key_reader, and instead of hitting keys just close the terminal window, it does not exit and it cooks CPU in the background.

Call graph:
    2365 Thread_4317572   DispatchQueue_1: com.apple.main-thread  (serial)
      2365 start  (in dyld) + 2544  [0x1946f7e50]
        2365 main  (in fish_key_reader) + 496  [0x102520ea0]
          2365 setup_and_process_keys(bool, bool)  (in fish_key_reader) + 220  [0x102520f7c]
            2363 process_input(bool, bool)  (in fish_key_reader) + 324  [0x1025210cc]
            + 1616 input_event_queue_t::readch_timed()  (in fish_key_reader) + 296  [0x102597440]
            + ! 852 input_event_queue_t::readch()  (in fish_key_reader) + 288  [0x1025970ec]
            + ! : 850 __select  (in libsystem_kernel.dylib) + 8  [0x1949eda74]
            + ! : 1 DYLD-STUB$$select  (in fish_key_reader) + 4  [0x102629aa0]
            + ! : 1 select  (in libsystem_kernel.dylib) + 0  [0x1949e7478]
            + ! 726 input_event_queue_t::readch()  (in fish_key_reader) + 452  [0x102597190]
            + ! : 721 read_blocked(int, void*, unsigned long)  (in fish_key_reader) + 44  [0x1025359b0]
            + ! : | 714 read  (in libsystem_kernel.dylib) + 8,16  [0x1949e39ac,0x1949e39b4]
            + ! : | 7 read  (in libsystem_kernel.dylib) + 28  [0x1949e39c0]
            + ! : |   6 cerror  (in libsystem_kernel.dylib) + 44  [0x1949e46b4]
            + ! : |   ! 6 cerror_nocancel  (in libsystem_kernel.dylib) + 8  [0x1949e37b0]
            + ! : |   1 read  (in libsystem_kernel.dylib) + 28  [0x1949e39c0]
            + ! : |     1 cerror  (in libsystem_kernel.dylib) + 28  [0x1949e46a4]
            + ! : 2 input_event_queue_t::readch()  (in fish_key_reader) + 452  [0x102597190]
            + ! : | 2 read_blocked(int, void*, unsigned long)  (in fish_key_reader) + 36  [0x1025359a8]
            + ! : 2 read_blocked(int, void*, unsigned long)  (in fish_key_reader) + 56  [0x1025359bc]
            + ! : | 2 __error  (in libsystem_kernel.dylib) + 0  [0x1949e37cc]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 764  [0x1025972c8]
            + ! 6 input_event_queue_t::readch()  (in fish_key_reader) + 364  [0x102597138]
            + ! : 5 fd_readable_set_t::test(int) const  (in fish_key_reader) + 52  [0x1025ed458]
            + ! : | 2 fd_readable_set_t::test(int) const  (in fish_key_reader) + 52  [0x1025ed458]
            + ! : | + 2 __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 20,28  [0x1949f7f54,0x1949f7f5c]
            + ! : | 2 fd_readable_set_t::test(int) const  (in fish_key_reader) + 52  [0x1025ed458]
            + ! : | 1 DYLD-STUB$$__darwin_check_fd_set_overflow  (in fish_key_reader) + 4  [0x102629458]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 364  [0x102597138]
            + ! :   1 fd_readable_set_t::test(int) const  (in fish_key_reader) + 28  [0x1025ed440]
            + ! 5 input_event_queue_t::readch()  (in fish_key_reader) + 116  [0x102597040]
            + ! : 3 input_event_queue_t::try_pop()  (in fish_key_reader) + 320  [0x102596fbc]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 116  [0x102597040]
            + ! : | 1 input_event_queue_t::try_pop()  (in fish_key_reader) + 40  [0x102596ea4]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 116  [0x102597040]
            + ! 5 input_event_queue_t::readch()  (in fish_key_reader) + 204  [0x102597098]
            + ! : 2 fd_readable_set_t::add(int)  (in fish_key_reader) + 156  [0x1025ed3dc]
            + ! : | 1 fd_readable_set_t::add(int)  (in fish_key_reader) + 156  [0x1025ed3dc]
            + ! : | + 1 __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 28  [0x1949f7f5c]
            + ! : | 1 fd_readable_set_t::add(int)  (in fish_key_reader) + 156  [0x1025ed3dc]
            + ! : 2 fd_readable_set_t::add(int)  (in fish_key_reader) + 12,216  [0x1025ed34c,0x1025ed418]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 204  [0x102597098]
            + ! :   1 fd_readable_set_t::add(int)  (in fish_key_reader) + 136  [0x1025ed3c8]
            + ! 5 input_event_queue_t::readch_timed()  (in fish_key_reader) + 296  [0x102597440]
            + ! : 5 input_event_queue_t::readch()  (in fish_key_reader) + 44,76,...  [0x102596ff8,0x102597018,...]
            + ! 3 input_event_queue_t::readch()  (in fish_key_reader) + 140  [0x102597058]
            + ! : 3 input_event_queue_t::prepare_to_select()  (in fish_key_reader) + 0  [0x1025976ac]
            + ! 3 input_event_queue_t::readch()  (in fish_key_reader) + 152  [0x102597064]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 152  [0x102597064]
            + ! : | 1 input_event_queue_t::try_pop()  (in fish_key_reader) + 36  [0x102596ea0]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 160  [0x10259706c]
            + ! : 1 input_event_queue_t::try_pop()  (in fish_key_reader) + 320  [0x102596fbc]
            + ! 3 input_event_queue_t::readch()  (in fish_key_reader) + 192  [0x10259708c]
            + ! : 3 fd_readable_set_t::clear()  (in fish_key_reader) + 20  [0x1025ed31c]
            + ! 3 input_event_queue_t::readch()  (in fish_key_reader) + 304  [0x1025970fc]
            + ! : 2 fd_readable_set_t::test(int) const  (in fish_key_reader) + 52  [0x1025ed458]
            + ! : | 1 DYLD-STUB$$__darwin_check_fd_set_overflow  (in fish_key_reader) + 4  [0x102629458]
            + ! : | 1 fd_readable_set_t::test(int) const  (in fish_key_reader) + 52  [0x1025ed458]
            + ! : |   1 __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 20  [0x1949f7f54]
            + ! : 1 input_event_queue_t::readch()  (in fish_key_reader) + 336  [0x10259711c]
            + ! 2 input_event_queue_t::readch()  (in fish_key_reader) + 256  [0x1025970cc]
            + ! : 2 input_event_queue_t::readch()  (in fish_key_reader) + 260  [0x1025970d0]
            + ! 1 input_event_queue_t::readch()  (in fish_key_reader) + 172  [0x102597078]
            + ! : 1 universal_notifier_t::default_notifier()  (in fish_key_reader) + 20  [0x10255d3dc]
            + ! 1 input_event_queue_t::readch()  (in fish_key_reader) + 240  [0x1025970bc]
            + ! : 1 (anonymous namespace)::universal_notifier_notifyd_t::notification_fd() const  (in fish_key_reader) + 0  [0x10255f1f0]
            + ! 1 input_event_queue_t::readch()  (in fish_key_reader) + 272  [0x1025970dc]
            + !   1 input_event_queue_t::readch()  (in fish_key_reader) + 272  [0x1025970dc]
            + 738 input_event_queue_t::readch_timed()  (in fish_key_reader) + 248  [0x102597410]
            + ! 736 pselect  (in libsystem_kernel.dylib) + 112  [0x1949fbb34]
            + ! : 736 __pselect  (in libsystem_kernel.dylib) + 8  [0x1949e9024]
            + ! 1 input_event_queue_t::readch_timed()  (in fish_key_reader) + 248  [0x102597410]
            + ! : 1 pselect  (in libsystem_kernel.dylib) + 84  [0x1949fbb18]
            + ! 1 pselect  (in libsystem_kernel.dylib) + 28  [0x1949fbae0]
            + 4 input_event_queue_t::readch_timed()  (in fish_key_reader) + 32  [0x102597338]
            + ! 2 input_event_queue_t::readch_timed()  (in fish_key_reader) + 32  [0x102597338]
            + ! : 2 input_event_queue_t::try_pop()  (in fish_key_reader) + 28,40  [0x102596e98,0x102596ea4]
            + ! 2 input_event_queue_t::readch_timed()  (in fish_key_reader) + 104,140  [0x102597380,0x1025973a4]
            + 3 input_event_queue_t::readch_timed()  (in fish_key_reader) + 180  [0x1025973cc]
            + ! 1 __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 100  [0x1949f7fa4]
            + ! 1 input_event_queue_t::readch_timed()  (in fish_key_reader) + 180  [0x1025973cc]
            + ! : 1 __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 20  [0x1949f7f54]
            + ! 1 input_event_queue_t::readch_timed()  (in fish_key_reader) + 244  [0x10259740c]
            + 2 process_input(bool, bool)  (in fish_key_reader) + 344  [0x1025210e0]
            2 process_input(bool, bool)  (in fish_key_reader) + 160  [0x102521028]
              2 reader_test_and_clear_interrupted()  (in fish_key_reader) + 4,16  [0x1025c5104,0x1025c5110]

Total number in stack (recursive counted multiple, when >=5):
        7       input_event_queue_t::readch()  (in fish_key_reader) + 0  [0x102596fcc]
        5       __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib) + 0  [0x1949f7f40]
        5       input_event_queue_t::try_pop()  (in fish_key_reader) + 0  [0x102596e7c]

Sort by top of stack, same collapsed (when >= 5):
        __select  (in libsystem_kernel.dylib)        850
        __pselect  (in libsystem_kernel.dylib)        736
        read  (in libsystem_kernel.dylib)        714
        input_event_queue_t::readch()  (in fish_key_reader)        12
        input_event_queue_t::try_pop()  (in fish_key_reader)        8
        __darwin_check_fd_set_overflow  (in libsystem_kernel.dylib)        6
        cerror_nocancel  (in libsystem_kernel.dylib)        6

@floam floam added the bug Something that's not working as intended label Oct 27, 2022
@floam floam added this to the fish-future milestone Oct 27, 2022
@floam floam changed the title fish_key_reader keeps running in background at 100% fish_key_reader keeps running in background at 100%, ignoring SIGHUP Oct 27, 2022
@floam floam closed this as completed in b7593a3 Oct 28, 2022
@mqudsi
Copy link
Contributor

mqudsi commented Oct 28, 2022

Nice find, @floam!

@mqudsi mqudsi modified the milestones: fish-future, fish 3.6.0 Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants