At times adb not showing android device connected even it is connected/online

I already tried, this didn’t worked.
I have a workaround on this, only forceful termination of adb solves this issue (either by killing through task manager or restarting the PC).
I want to know the exact source which is leading to this error or else something by which i can avoid this error.