logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
NWNX-Speech
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
Alun



Joined: 20 Feb 2005
Posts: 5
Location: Germany

PostPosted: Mon Mar 07, 2005 2:21    Post subject: Reply with quote

I'm currently installing the listener; just a minor: the init script nwnspeech is missing Wink

EDIT: Ok, another problem: The NWNX log says SPEECH is registered, with nwnx_speech.txt holding all those verbs. But the logfile of nwnspeechd (nwnspeech.txt) is non-existent, and no nwnspeechd in process table. I tracked it down to a problem with setsid(). Keep up the good work.

Details: running Debian linux 2.6.8,
Code:
root@debian:# ldd /usr/bin/nwnspeechd
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4002a000)
        libpcap.so.0.8 => /usr/lib/libpcap.so.0.8 (0x40039000)
        libmysqlclient.so.12 => /usr/lib/libmysqlclient.so.12 (0x4005f000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4009d000)
        libm.so.6 => /lib/tls/libm.so.6 (0x40157000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40179000)
        libc.so.6 => /lib/tls/libc.so.6 (0x40182000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libz.so.1 => /usr/lib/libz.so.1 (0x402b6000)
        libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0x402c9000)
        libnsl.so.1 => /lib/tls/libnsl.so.1 (0x402f6000)
(wasn't there version info included once??) gcc 3.3.5, glibc 2.3.2, libpcap 0.8.3, libmysql 4.0.23
Code:
root@debian:# cat /etc/nwnspeech.conf
[nwnspeech]
runas=nwn
autoemote=true
logmask=127
newfeatures=true
mode=plugin
logfile=/home/nwn/logs.0/nwnspeech.txt
interface=eth0
address=192.168.3.61
#pidfile=/var/run/nwnspeechd.pid # unused for right now

[plugin]
socketname=/tmp/nwnspeech #

[database]
provider=mysql
username=nwn
password=*******
dbname=nwnx
host=localhost

_________________
Stay cool and have fun...
Back to top
View user's profile Send private message Visit poster's website
Alun



Joined: 20 Feb 2005
Posts: 5
Location: Germany

PostPosted: Mon Mar 07, 2005 4:22    Post subject: Reply with quote

Ah, I couldn't sleep till I figured this one out. I simply made a little fix, and it works nicely now (in a first test):
In nwnspeech/daemon/nwnspeechd.cpp search the lines
Code:
pid_t sid = setsid();
if (sid < 0) {
    exit (EXIT_FAILURE);
}
and replace it with
Code:
pid_t sid = setsid();
(setsid() returns -1 when the process is already a process group leader and has nothing to do)
_________________
Stay cool and have fun...
Back to top
View user's profile Send private message Visit poster's website
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Mon Mar 07, 2005 5:59    Post subject: Reply with quote

Erk; so it is (missing). And thanks for the info on setsid, I'll include it in the next update. I wonder why it works correctly for me.

As an aside, I also found a very minor issue, in which the "POP" commands getting received are getting logged at the "INFO" level, making a lot of spam at the default logging level.

Here's the init script, you can copy into /etc/init.d/nwnspeech, and should then be able to chkconfig --add

Code:

# /bin/bash
#   starts and stop the talus listener daemon
# Author: Marc Paradise (Grinning Fool)   gf@dragonwell.org
#
# chkconfig: 2345 86 20
# description: Starts the Talus NWN Listener Daemon, which listens for NWN conversation packets and copies them into the game database
# processname: nwnspeechd
# config: /etc/nwnspeechd.conf
# pidfile: /var/run/nwnspeechd.pid

# Source function library
. /etc/init.d/functions


# Default to ethernet card 1 (eth0), address 2 on that card (external IP), with autoemotes turned on and version 3 table support
# For a full list of options, run the daemon with a parameter of -h
# This could also be moved to a file in /etc
# TO DO: Modify listener to accept the config file as an option

name="Talus NWN Speech Listener Daemon"
RETVAL=0

# Check that networking is up
if [ "$NETWORKING" = "no" ]; then
    exit 0;
fi

# Make sure the file exists
[ -f $app ] || exit 0

start() {
        gprintf "Starting $name: "
        daemon --check nwnspeechd nwnspeechd &
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nwnspeechd
        return $RETVAL
}

stop() {
        gprintf "Stopping $name: "
        killproc nwnspeechd
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f  /var/lock/subsys/nwnspeechd
        return $RETVAL
}

restart() {
        stop
        start
}
# See how we were called.
case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        status)
                status nwnspeechd
                ;;
        restart|reload)
                restart
                ;;
        condrestart)
                [ -f /var/lock/subsys/nwnspeechd ] && restart || :
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
                exit 1
esac


Back to top
View user's profile Send private message
Alun



Joined: 20 Feb 2005
Posts: 5
Location: Germany

PostPosted: Mon Mar 07, 2005 7:15    Post subject: Reply with quote

Grinning Fool wrote:
Code:

# Make sure the file exists
[ -f $app ] || exit 0

I'm not sure, but I think this line will not work, $app is not initialized. However, with debian linux this script won't work anyway. I adopted it for Debian users. Place it into /etc/init.d/
Code:
#!/bin/bash
#   starts and stop the talus listener daemon
# Author: Marc Paradise (Grinning Fool)   gf@dragonwell.org
# Adopted for Debian: Christian Biener (Alun Tringat)   alun@emerald-coast.de
#
# chkconfig: 2345 86 20
# description: Starts the Talus NWN Listener Daemon, which listens for NWN conversation packets and copies them into the game database
# processname: nwnspeechd
# config: /etc/nwnspeechd.conf

# Default to ethernet card 1 (eth0), address 2 on that card (external IP), with autoemotes turned on and version 3 table support
# For a full list of options, run the daemon with a parameter of -h
# This could also be moved to a file in /etc
# TO DO: Modify listener to accept the config file as an option

DESC="Talus NWN Speech Listener Daemon"
NAME=nwnspeechd
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Check that networking is up
if [ "$NETWORKING" = "no" ]; then
    exit 0;
fi

# Make sure the file exists
[ -f $DAEMON ] || exit 0

start() {
    echo -n "Starting $NAME: "
    start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --make-pidfile --background
    echo $DESC
}

stop() {
    echo -n "Stopping $NAME: "
    # start-stop-daemon --stop --pidfile $PIDFILE --name $NAME
    # Since we have multiple instances of nwnspeechd (with no parent process)
    # we can't use pidfile and have to killall, with 5 seconds timeout before kill -KILL
    start-stop-daemon --stop --name $NAME --retry 5 --oknodo
    rm -f $PIDFILE
    echo $DESC
}

restart() {
    stop
    start
}

# See how we were called.
case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
status)
    # status nwnspeechd
    #   will not work; workaround: list all PIDs
    echo `ps -A|grep $NAME`
    ;;
restart|reload)
    restart
    ;;
condrestart)
    [ -f $PIDFILE ] && restart || :
    ;;
*)
    echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
    exit 1
esac

_________________
Stay cool and have fun...


Last edited by Alun on Mon Mar 07, 2005 14:50; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Alun



Joined: 20 Feb 2005
Posts: 5
Location: Germany

PostPosted: Mon Mar 07, 2005 8:02    Post subject: Reply with quote

As a side note: You may not want to call the init script nwnspeechd, or it will be killed like the daemon when you try to stop the daemon (because of the same name; all processes called nwnspeechd get killed). Call it nwnspeech Smile

BTW. what's that setsid() for anyway? sid doesn't get used anywhere else.
_________________
Stay cool and have fun...
Back to top
View user's profile Send private message Visit poster's website
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Mon Mar 07, 2005 21:56    Post subject: Reply with quote

Quote:
You may not want to call the init script nwnspeechd

Correct, my copy is saved as "nwnspeech". Just rereading some of that init script, and your observation about [ -f $app] is obviously correct. Once again, I'm left wondering how it works on my systems.

Also, some comments near the top of the file (regarding options and settings) that are a carryover from the first linux version I had done, which took those options as command line parameters. (The -f $app was a carryover from an earlier version as well).

Quote:
BTW. what's that setsid() for anyway

Found reference to that for use in creating daemon procs ... that was /supposed/ to be in the chunk of code that was commented out for my own later research into how to best write daemons.

... bear with me here, I'm a recovering Windows programmer learning linux ins and outs by trial and error. Not that this excuses these particular issues, but I can try and hide behind it for a little while at least Wink
Back to top
View user's profile Send private message
dguntner



Joined: 31 Dec 2004
Posts: 116

PostPosted: Wed Mar 09, 2005 8:37    Post subject: Reply with quote

I haven't had a chance to download and look at it yet, but am I correct in guessing that there's some kind of .conf file for the listener program that tells it what database, table, username, pw, etc., to use?

--Dave
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Wed Mar 09, 2005 8:57    Post subject: Reply with quote

Yes. /etc/nwnspeech.conf, included. The default settings run in 'plugin' mode and don't create a database setting.

seem to have found a bug, too tired to think it through tonight, but doing a netstat after the server has been running for a while, I see 8-10 open streams to the /tmp/nwnspeech, all from nwnspeechd, same pid.

I do know that the connection was restarted a couple of times (there's a 10 or 100 ms timeout on the socket to prevent from hanging the game), I'm wondering if that's the cause of this. I'll have to dig into it tomorrow (this is mostly just a note to self so I don't forget Wink )
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Tue Mar 15, 2005 2:40    Post subject: Reply with quote

Anyone else have a chance to work with this?
Back to top
View user's profile Send private message
morklebb



Joined: 25 Mar 2005
Posts: 1

PostPosted: Fri Mar 25, 2005 23:40    Post subject: Reply with quote

Grinning Fool wrote:
Anyone else have a chance to work with this?


I messed around with it and after some trouble on a RHEL4 system with it not finding the libmysqlclient (added -L /usr/lib/mysql to fix to Makefile) I got it to compile.

I can launch it and it just runs then immedately dies without saying anything else. No log, no socket, nothing.

I will look into why this is, might have to do with new 2.6 kernel or something?

Brent
Back to top
View user's profile Send private message
Alun



Joined: 20 Feb 2005
Posts: 5
Location: Germany

PostPosted: Sat Mar 26, 2005 1:57    Post subject: Reply with quote

Try removing the lines 851 to 854 of file daemon/nwnspeechd.cpp
Code:
    pid_t sid = setsid();
    if (sid < 0) {
        exit(EXIT_FAILURE);
    }
Then recompile the daemon.
_________________
Stay cool and have fun...
Back to top
View user's profile Send private message Visit poster's website
darwinscusp



Joined: 19 Jan 2005
Posts: 19

PostPosted: Fri May 06, 2005 22:37    Post subject: Reply with quote

Following all the instructions here, I got this all up and running. The socket exists, and the "/o" reports as tells back to my PC.

In nwnx_speech.txt I've got a slew of errors reporting:

Attempting to connect to server.Connecting to speech server.
Connected to speech server.
ERROR: Server closed connection with RC 11. Will attempt to reestablish on the next call.

over and over again.

Also, *help* and /o help don't seem to report anything.

This is on RHEL4.
Back to top
View user's profile Send private message
vallis



Joined: 13 Jun 2005
Posts: 6

PostPosted: Mon Jun 13, 2005 20:57    Post subject: Reply with quote

Grinning Fool wrote:
Quote:
You may not want to call the init script nwnspeechd

Correct, my copy is saved as "nwnspeech". Just rereading some of that init script, and your observation about [ -f $app] is obviously correct. Once again, I'm left wondering how it works on my systems.
... stuff deleted....


Hi,

The [ -f $app ] test returns true on your system (or any system using bash for that matter), because $app isn't initialized and you didn't enclose the variable in quotes. Essentially, the expression evaluates to this:

[ -f ]

which will always return true. (Try it if you don't believe me =))

The proper way to do this is to quote the variable like this:

[ -f "$app" ]

then it will do what you think it should.

It works like this because uninitialized variables do not evaluate to null when evaluated if they aren't quoted. Why that is, I don't know.

Pretty much, you probably want to enclose any variables in double quotes if you are going to use them in a test to protect yourself from this kind of thing.

V.
Back to top
View user's profile Send private message
vallis



Joined: 13 Jun 2005
Posts: 6

PostPosted: Wed Jun 15, 2005 6:56    Post subject: Reply with quote

Grinning Fool wrote:
Anyone else have a chance to work with this?


Yes, I've got it working pretty well, although I did see a nwserver lockup this evening after pulling the lever to grant my test character access to the extended commands.

I have seen the stale connections like you saw. They are definitely due to nwserver exiting. For some reason the connection to the socket stays open.
I will probably look at this in depth tomorrow.

Otherwise, it's working great!

V.
Back to top
View user's profile Send private message
dguntner



Joined: 31 Dec 2004
Posts: 116

PostPosted: Tue Aug 02, 2005 7:32    Post subject: Reply with quote

Grinning Fool wrote:
Still some quirks and thigns to take a closer look at... but give ita try, and feed back with any issues or comments here...

THe basic structure is as I originally proposed, a plugin that speaks to a standalone executable, which is running as a daemon.

http://www.dragonwell.org/downloads/lds_talus_speech_30a_linux.tar.gz


Have there been any new developments on this? Any updates, etc.? Any stability problems reported?

Am getting to the point where I'd like to try this out, since I *really* don't like running nwserver as root.... Smile

--Dave
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 5 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group