irontec / sngrep

Ncurses SIP Messages flow viewer
GNU General Public License v3.0
1.02k stars 187 forks source link

100 cpu when ssh connection disconnected #424

Closed isrlgb closed 1 year ago

isrlgb commented 1 year ago

hi using the latest version if running sngrep and the ssh connection drops sngrep continues to run and 100% cpu

root 3015 91.5 3.9 357416 324164 ? Rl Jan05 3028:35 sngrep -c image image

what can be done

Kaian commented 1 year ago

Hi!

There is no much you can do at that point, apart from killing the process. I recommend creating an alias for sngrep to avoid running for too long periods.

alias sngrep='timeout 600 sngrep' 

Or something like that to autostop sngrep after 10 minutes.

Regards

isrlgb commented 1 year ago

the idea is nice but isnt it a bug that with a orphaned sngrep where its trying to ouput to the tty that is gone?

Kaian commented 1 year ago

Hi!

I've done some testing and looks like sngrep receives SIGCONT signal when parent ssh connections dissapears, si I have add it the signal exit handler.

Not sure if this will work in every scenario (I have tested killing the client connection), but let's give it a try.

This will be included in sgrep 1.7.0

Thanks for the report @isrlgb !!

isrlgb commented 1 year ago

Thank you very much!

denyspozniak commented 1 year ago

@Kaian we usually keep sngrep running in the subshell via screen, could this commit affect that?

Kaian commented 1 year ago

@denyspozniak It may affect. For example, running sngrep in background with & at the end seems to work, but halting a running sngrep with Ctrl+Z and sending it to background with bg, will stop it.

As far as I understand, screen is the one being run in background and not sngrep, so no signal should be received in that case, but I would recommend to try the above commit and report any finding.

Regards

isrlgb commented 1 year ago

i have compiled from git and it fixed the problem for me but still runs in screen so that looks ok

On Tue, Feb 28, 2023 at 5:10 PM Kaian @.***> wrote:

@denyspozniak https://github.com/denyspozniak It may affect. For example, running sngrep in background with & at the end seems to work, but halting a running sngrep with Ctrl+Z and sending it to background with bg, will stop it.

As far as I understand, screen is the one being run in background and not sngrep, so no signal should be received in that case, but I would recommend to try the above commit and report any finding.

Regards

— Reply to this email directly, view it on GitHub https://github.com/irontec/sngrep/issues/424#issuecomment-1448356087, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7ZUFIMSAR6BIDPPYNFNRLWZYIQBANCNFSM6AAAAAATUFNFVM . You are receiving this because you were mentioned.Message ID: @.***>