romkatv / powerlevel10k

A Zsh theme
MIT License
46.61k stars 2.19k forks source link

file handles on deleted files #1674

Closed michaelfruth closed 2 years ago

michaelfruth commented 2 years ago

Hi,

Executing sudo lsof -n | grep /tmp | grep deleted on a Debian System with OhMyZSH + Powerlevel10k shows me that Powerlevel10k/gitstatus has a lot of opened file handles on deleted files.

Here is an example of the command above:

zsh       5826                    michael   11w     FIFO               0,34      0t0      70627 /tmp/p10k.worker.1000.5826.1639728475.fifo (deleted)
zsh       5826                    michael   15w     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
zsh       6689                    michael    0r     FIFO               0,34      0t0      70627 /tmp/p10k.worker.1000.5826.1639728475.fifo (deleted)
zsh       6693                    michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698                    michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6699 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6700 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6701 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6702 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6703 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6704 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6705 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6706 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6707 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6708 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6709 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6710 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6711 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6712 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6713 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6714 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6715 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6716 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6717 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6718 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6719 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6720 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6721 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6722 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6723 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6724 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6725 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6726 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6727 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6728 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6729 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)
gitstatus 6698 6730 gitstatus     michael    0r     FIFO               0,34      0t0      69557 /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo (deleted)

How can this be fixed?

romkatv commented 2 years ago

The output of the command shows two deleted fifos: /tmp/p10k.worker.1000.5826.1639728475.fifo and /tmp/gitstatus.POWERLEVEL9K.1000.5826.1639728475.1.fifo. This is the expected number of deleted fifos per interactive zsh with powerlevel10k.

Does having two deleted fifos cause issues?

romkatv commented 2 years ago

By the way, you can use lsof -nKi to avoid listing the same file descriptor more than once.

michaelfruth commented 2 years ago

I faced a problem in not being able to create new files on /tmp because " No space left on device". Killing these two processes resolved it intermediately, but as I found out now, this was not the root cause (cause was that I run out of Inodes). So when these two file handles are expected, I will close the issue. Thanks for your help!

romkatv commented 2 years ago

Thanks for the update.

For the reference, powerlevl10k uses a deleted fifo to communicate with gitstatusd. In the ideal world it would use pipe(2) but zsh doesn't expose this function. A deleted fifo is the closest thing.