Server hangs when compiled without CURL (edited)

A place for people to post strange occurances that could be potential bugs.

Moderator: Board moderators

Post Reply
Reven
Luser
Posts: 25
Joined: Mon Sep 11, 2006 1:04 am

Server hangs when compiled without CURL (edited)

Post by Reven »

I've compiled the server (version 1.70) on an HPPA (PA-RISC) machine running Debian. When I try to connect a client to it, the connection fails silently. No error message on client or server. On the client the connection dialog disappears for about five seconds, then it comes back.

Network-wise, I can see the connection is made, one data packet is sent from client to server, then the client disconnects, presumably because the server never responded. The connection is successful, and the one packet sent from client to server is acknowledged, so I know the server is getting it.

At this point I am suspecting an endian issue. Does anyone have the server successfully running on a big-endian machine?
Last edited by Reven on Mon Apr 01, 2013 2:51 pm, edited 1 time in total.
Reven
Luser
Posts: 25
Joined: Mon Sep 11, 2006 1:04 am

Post by Reven »

I found the bug. It's not an endian issue. It's the use of an uninitialized mutex.

The initialization of ms2_info_mutex, in metaserer.c:metaserver2_init() is behind an #ifdef:

Code: Select all

#ifdef HAVE_CURL_CURL_H
    if (!has_init) {
        memset(&local_info, 0, sizeof(LocalMeta2Info));
        memset(&metaserver2_updateinfo, 0, sizeof(MetaServer2_UpdateInfo));

        local_info.portnumber = settings.csport;
        metaserver2 = NULL;
        pthread_mutex_init(&ms2_info_mutex, NULL);
...but the use of that mutex in metaserver.c:metaserver_update() is not behind the same #ifdef.
Leaf
Forum Aficionado
Posts: 1994
Joined: Tue Apr 29, 2003 5:55 pm
Location: Minnesota, USA
Contact:

Post by Leaf »

What happens when you specific the server when launching the client?

ie,
./client.svn/gtk-v2/src/crossfire-client-gtk2 -server 127.0.0.1

Does the client connect to the server okay or does it still hang?
"Put another, more succinct way: don't complain, contribute. It's more satisfying in the long run, and it's more constructive."
Eric Meyer
Reven
Luser
Posts: 25
Joined: Mon Sep 11, 2006 1:04 am

Post by Reven »

I should have updated this earlier.

First...
Leaf wrote:What happens when you specific the server when launching the client ... Does the client connect to the server okay or does it still hang?
Yes the client hangs. I verified with gdb that the server was stuck at the pthread_mutex_lock() call in metaserver_update(). That lock never ever returns because the mutex was uninitialized since I didn't have curl at the time.

I subsequently put all the metaserver update code behind the same #ifdef that the initialization code was behind, and it works fine. Fix is checked into CVS.

Of course Leaf knows all this already, but for anyone else who might come along...
Post Reply