SRCDS Steam group


Server hard locks
#1
I am running two srcds servers configured as follows:

Server 1:
AMD 64 FX-53
2GB RAM
Ubuntu 7.10
Counter Strike
MetaMod 1.43
ManiMod 1.2S

Server 2:
AMD 64x2
2GB RAM
Ubuntu 7.10
MetaMod 1.43
ManiMod 1.2S

Both servers experience intermittent hard locks which require a restart to resolve. Server 2 experiences this lock quite frequently immediately when the server is started and I have to quit out of the srcds process and execute the start script 2-3 times before the game will start running.

When the servers lock I cannot type in the cosnole and all players are disconnected and cannot rejoin until srcds is restarted.

Any ideas how this can be resolved?
Reply
#2
yea i get this too, ive been running +nomaster on my private server and its seeming to help, but then it wont show up in the server list.

another source for the freezing happens and it freezes on executing the banned ip file. Im not sure how to resolve that one
Reply
#3
I'm getting the same here, only happens on one server/box though.
Reply
#4
I also get something like this, or when I first startup my server it hangs and I have to kill the screen and try to open it again. Makes me sad because my scripts I got going now if it crashes it does not always startup for me. Sad Not good.
Reply
#5
Yep, same. It usually dies after the line that contains all the [Scene] 2.10mb crap. It freezes on startup about 20% of the time
Reply
#6
yeah i get the exact same issue... is there any solution for it ??
Reply
#7
I have the same issue with server locking up at startup 20-50% of the time. Are we all using Ubuntu?

I haven't experienced the server locking up after a successful start yet, but that may be because I haven't run it long enough to find out.

Perhaps it is something related with Ubuntu.
Reply
#8
I wrote a small dameon app in C that attempts to connect to my CS servers a few times and then restarts them if it fails. Following is the code:

Code:
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/stat.h>

#define BUFFSIZE 32

void Die(char *mess)
{
    fprintf(stderr, mess);
    exit(1);
}

static void daemonize(void)
{
        pid_t pid, sid;

        /* already a daemon */
        if ( getppid() == 1 ) return;

        /* Fork off the parent process */
        pid = fork();
        if (pid < 0)
    {
            exit(EXIT_FAILURE);
        }
        /* If we got a good PID, then we can exit the parent process. */
        if (pid > 0)
    {
            exit(EXIT_SUCCESS);
        }

        /* At this point we are executing as the child process */

        /* Change the file mode mask */
        umask(0);

        /* Create a new SID for the child process */
        sid = setsid();
        if (sid < 0)
    {
            exit(EXIT_FAILURE);
        }

        /* Change the current working directory.  This prevents the current
           directory from being locked; hence not being able to remove it. */
        if ((chdir("/")) < 0)
    {
            exit(EXIT_FAILURE);
        }

        /* Redirect standard files to /dev/null */
        freopen( "/dev/null", "r", stdin);
        freopen( "/dev/null", "w", stdout);
        freopen( "/dev/null", "w", stderr);
}

int main(int argc, char *argv[])
{

    int sock;
           struct sockaddr_in server;
           char buffer[BUFFSIZE];
           unsigned int echolen;
           int received = 0;
      char c[50];
      FILE *config;

    if (argc == 1)
    {
        daemonize();
        }
    else
    {
        if (strcmp(argv[1], "-debug") != 0)
        {
            Die("USAGE:  cs-watcher [-debug]\n");
        }
    }
    
    while (1)
    {
        sleep(10);
            /* Create the TCP socket */
            if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
        {
                      Die("Failed to create socket");
            }

        fprintf(stderr, "TCP socket created...\n");    

          config = fopen("watchdog.conf", "r");

          if(config==NULL)
        {
                Die("Error: can't open watchdog.conf");
          }
          else     
        {
                fprintf(stderr, "Config file found.\n");
    
                while(fgets(c, 50, config) != NULL)
            {
                if (c[0] != '#')
                {
                        /* Construct the server sockaddr_in structure */
                        memset(&server, 0, sizeof(server));       /* Clear struct */
                        server.sin_family = AF_INET;                  /* Internet/IP */
                        server.sin_addr.s_addr = inet_addr(strtok(c, " "));  /* IP address */
                        server.sin_port = htons(atoi(strtok(NULL, " ")));       /* server port */

                    fprintf(stderr, "Server sockaddr_in structure constructed...\n");
    
                    /* Establish connection */
                        if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0)
                    {
                        /* Connect failed, sleep for 10 more secs and see if we just seg faulted and the server restarts itself */
                        sleep(10);
                        if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0)
                        {
                            /* Connect failed again, looks like its locked up...need to restart it */
                            fprintf(stderr, "Could not connect, restarting srcds...\n");
                                    system(strcat(strcat("/etc/init.d/cs-server", c), ".service stop"));
                            system(strcat(strcat("/etc/init.d/cs-server",c), ".service start"));
                        }
                        }
                    else
                    {
                        fprintf(stderr, "Connected!\n");
                    }
    
                        close(sock);
                }
            }      
            }

            fprintf(stderr, "Closing config file...\n");

            fclose(config);
        }
}

It looks for a config file called watchdog.conf in its install directory which is formatted as follows:

<server ip> <port number>

The watchdog ignores lines beginning with '#' so you can add comments if you want.

Compile the above code with 'gcc -o watchdog <name of source file>' and add the resulting binary to your service start script. It works to some extent, at least my servers don't stay locked up anymore.
Reply
#9
I haven't looked at the mailing lists for a while now, but saw this and it looks relevant: http://www.mail-archive.com/hlds_linux@list.valvesoftware.com/msg46219.html
Reply
#10
disco Wrote:I haven't looked at the mailing lists for a while now, but saw this and it looks relevant: http://www.mail-archive.com/hlds_linux@list.valvesoftware.com/msg46219.html

Completely relevant in my case. This is exactly the issue I am having.
Reply
#11
(04-14-2008, 01:50 AM)GameWager Wrote:  I wrote a small dameon app in C that attempts to connect to my CS servers a few times and then restarts them if it fails. Following is the code:

Code:
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/stat.h>

#define BUFFSIZE 32

void Die(char *mess)
{
    fprintf(stderr, mess);
    exit(1);
}

static void daemonize(void)
{
        pid_t pid, sid;

        /* already a daemon */
        if ( getppid() == 1 ) return;

        /* Fork off the parent process */
        pid = fork();
        if (pid < 0)
    {
            exit(EXIT_FAILURE);
        }
        /* If we got a good PID, then we can exit the parent process. */
        if (pid > 0)
    {
            exit(EXIT_SUCCESS);
        }

        /* At this point we are executing as the child process */

        /* Change the file mode mask */
        umask(0);

        /* Create a new SID for the child process */
        sid = setsid();
        if (sid < 0)
    {
            exit(EXIT_FAILURE);
        }

        /* Change the current working directory.  This prevents the current
           directory from being locked; hence not being able to remove it. */
        if ((chdir("/")) < 0)
    {
            exit(EXIT_FAILURE);
        }

        /* Redirect standard files to /dev/null */
        freopen( "/dev/null", "r", stdin);
        freopen( "/dev/null", "w", stdout);
        freopen( "/dev/null", "w", stderr);
}

int main(int argc, char *argv[])
{

    int sock;
           struct sockaddr_in server;
           char buffer[BUFFSIZE];
           unsigned int echolen;
           int received = 0;
      char c[50];
      FILE *config;

    if (argc == 1)
    {
        daemonize();
        }
    else
    {
        if (strcmp(argv[1], "-debug") != 0)
        {
            Die("USAGE:  cs-watcher [-debug]\n");
        }
    }
    
    while (1)
    {
        sleep(10);
            /* Create the TCP socket */
            if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
        {
                      Die("Failed to create socket");
            }

        fprintf(stderr, "TCP socket created...\n");    

          config = fopen("watchdog.conf", "r");

          if(config==NULL)
        {
                Die("Error: can't open watchdog.conf");
          }
          else     
        {
                fprintf(stderr, "Config file found.\n");
    
                while(fgets(c, 50, config) != NULL)
            {
                if (c[0] != '#')
                {
                        /* Construct the server sockaddr_in structure */
                        memset(&server, 0, sizeof(server));       /* Clear struct */
                        server.sin_family = AF_INET;                  /* Internet/IP */
                        server.sin_addr.s_addr = inet_addr(strtok(c, " "));  /* IP address */
                        server.sin_port = htons(atoi(strtok(NULL, " ")));       /* server port */

                    fprintf(stderr, "Server sockaddr_in structure constructed...\n");
    
                    /* Establish connection */
                        if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0)
                    {
                        /* Connect failed, sleep for 10 more secs and see if we just seg faulted and the server restarts itself */
                        sleep(10);
                        if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0)
                        {
                            /* Connect failed again, looks like its locked up...need to restart it */
                            fprintf(stderr, "Could not connect, restarting srcds...\n");
                                    system(strcat(strcat("/etc/init.d/cs-server", c), ".service stop"));
                            system(strcat(strcat("/etc/init.d/cs-server",c), ".service start"));
                        }
                        }
                    else
                    {
                        fprintf(stderr, "Connected!\n");
                    }
    
                        close(sock);
                }
            }      
            }

            fprintf(stderr, "Closing config file...\n");

            fclose(config);
        }
}

It looks for a config file called watchdog.conf in its install directory which is formatted as follows:

<server ip> <port number>

The watchdog ignores lines beginning with '#' so you can add comments if you want.

Compile the above code with 'gcc -o watchdog <name of source file>' and add the resulting binary to your service start script. It works to some extent, at least my servers don't stay locked up anymore.

lovely, but could you provide the /etc/init.d/cs-server script as well?
Reply
#12
This is an old thread, Email the author, please don't raise old dead threads.
Looking for a game server? Visit fullfrag.com and pick one up as low as $2.50 / mo!
Reply
#13
if you can find a e-mail or pm button I'd happily do it Wink
Reply
#14
Eh, I guess you're not going to get what you wanted out of him then :/
Make a new thread requesting your information, somebody might have it.
Looking for a game server? Visit fullfrag.com and pick one up as low as $2.50 / mo!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)