Ad Widget

Collapse

SSH logout hangs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cooper
    Senior Member
    • Sep 2004
    • 110

    #1

    SSH logout hangs

    I have been experiencing this issue for some time now, and it hasnt really been a problem. But, I have some free time now so I thought I would share it and see if anyone else is experiencing it.

    I am running 1.1a6 on gentoo with the following
    2.6.2 kernel
    OpenSSH 3.6.1p2
    MySQL 4.0.16
    PHP 4.3.10
    Apache/2.0.52

    I access this box via ssh using putty for windows. If I ssh into the box and start any of the zabbix processes (server, sucker, trapper, agentd) when I logoff of ssh, the session hangs. It logs me out, but somthing is hanging it up, and putty doesnt close. If I ssh into the same box and do other things, when i logoff, no problems, clean exit. Its only if one of the zabbix processess gets started during a shell session.

    I have had this issue with 1.0 stable, and all of the 1.1 alphas I have used (about 4 of the 7). Anyone else experiencing anything similar? Or, do you have any thoughts as to why this might be happening?

    Thanks,

    cooper
  • rickardp
    Junior Member
    • Dec 2004
    • 27

    #2
    If you start something that binds to the pty, ssh will not release the terminal. I remember that there is a way to make a program disconnect from the pty where it was started. This is really not a zabbix problem (although it's annoying)

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      All ZABBIX daemon processes do disconnect from standard output streams (stdout, stderr).
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • James Wells
        Senior Member
        • Jun 2005
        • 664

        #4
        Greetings,

        Just running into this same issue. I decided to look through the source code and I see the problem, below is line 184 in zabbix_agentd.c, function daemon_init
        Code:
                for(i=0;i<MAXFD;i++)
                {
                        /* Do not close stderr */
                        if(i != fileno(stderr)) close(i);
                }
        I could be mistaken, but reading through the code a bit more, I believe this is the culprit. We never actually close stderr, which means we never disassociate from the PTY, hence sshe will fail to break the connection.

        Looking through the code a bit further, it appears that we only write to stderr one time after this is executed, and that is within the same function starting on line 194;
        Code:
        #ifdef HAVE_SYS_RESOURCE_SETPRIORITY
                if(setpriority(PRIO_PROCESS,0,5)!=0)
                {
                        fprintf(stderr, "Unable to set process priority to 5. Leaving default.\n");
                }
        #endif
        From what I can tell, we should be able to move this to just before we close the file handles and then close stderr as well. Not positive as there is still more code I need to peruse.
        Unofficial Zabbix Developer

        Comment

        • tronite
          Senior Member
          • Jun 2007
          • 147

          #5
          Originally posted by cooper
          I have been experiencing this issue for some time now, and it hasnt really been a problem. But, I have some free time now so I thought I would share it and see if anyone else is experiencing it.

          I am running 1.1a6 on gentoo with the following
          2.6.2 kernel
          OpenSSH 3.6.1p2
          MySQL 4.0.16
          PHP 4.3.10
          Apache/2.0.52

          I access this box via ssh using putty for windows. If I ssh into the box and start any of the zabbix processes (server, sucker, trapper, agentd) when I logoff of ssh, the session hangs. It logs me out, but somthing is hanging it up, and putty doesnt close. If I ssh into the same box and do other things, when i logoff, no problems, clean exit. Its only if one of the zabbix processess gets started during a shell session.

          I have had this issue with 1.0 stable, and all of the 1.1 alphas I have used (about 4 of the 7). Anyone else experiencing anything similar? Or, do you have any thoughts as to why this might be happening?

          Thanks,

          cooper
          Maybe it was to do with your forwarding and neting?

          Comment

          • tronite
            Senior Member
            • Jun 2007
            • 147

            #6
            It's a pity you never gave a response as to either you ever solved this or not.

            Comment

            Working...