SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Wed Nov 06, 2024 01:52
SMSTools3 Community » Help and support Bottom

[fixed in 3.1.6] smsd hanged?

  This topic is locked

Page:  1

Author Post
Member
Registered:
Oct 2009
Location: Latvia
Operating system name and version: Debian
Version of smsd: 3.1.5
Smsd installed from: sources
Name and model of a modem / phone: Nokia 30
Interface: serial with USB adapter

I have rear but regular problems ~ once a week when it looks like smsd does not work.
The last record in log file was:
SMS received (part 1/2) From: ...

From other side htop shows smsd in process list. :?

My modem leds shows "Message received" (green-red blink of third led).
After smsd restart all goes fine. It recieves second part of message and sends out unsent messages that was on phone memory ( I think so that I had no files in outgoing folder).

Is it bug or I can use setting:
receive_before_send = yes

How to track out the problem?
Increase loglevel?

brgds
Janeks

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Hm...
When I looked into htop after restart there was two smsd processes: mainprocess and GSM1
Before (when problems) was only one.

Janeks

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Perhaps this has something to do with multipart messages, do you often receive them, more than once per week?

There should always be two processes listed. When this failure happens, you could use ps -efj list to check if a modem process is in a <defunct> state.

After a second part is received, the message is complete, or is it broken somehow?

Smsd does not send unsent messages from the phones memory. The phone will do it by itself.

I do not know if there is a this kind of bug. However it seems that something abnormal has happened.

You could set loglevel = 7 and collect the log until this failure happens again. Then show the tail of a log with all lines which are related to the last couple of minutes. Also show the content of smsd.conf file.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
I am getting multipart messages more offten if not all the time.
The message received upon failure is o'k.

I raised loglevel - let's see...

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
One more thing: you have used this same modem, adapter and version of smsd from at least 5 weeks ago. Can you locate a date when the problem started to happen? If the problem is newer than 5 weeks, probably you could show your current eventhandler code.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Here is the eventhandler:

#!/bin/bash

if [ "$1" == "RECEIVED" ]; then
# Conversion to unicode
    if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
        TMPFILE=`mktemp /tmp/smsd_XXXXXX`
        sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
        sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
        mv $TMPFILE "$2"
    fi
           
fi

if [ "$1" == "SENT" ]; then
# Conversion to unicode
    if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
        TMPFILE=`mktemp /tmp/smsd_XXXXXX`
        sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
        sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
        mv $TMPFILE "$2"
    fi
           
fi

smsrebproc "$1" "$2" "$3" > /home/storage/smsproc/testproc.txt

# This is an example script that logs all events into an SQL database
# You need a MYSQL database as described in the documentation.
# Please read the documentation before using this script.

SQL_HOST=localhost
SQL_USER=******
SQL_PASSWORD="*********"
SQL_DATABASE=******
SQL_TABLE=*******

DATE=`date +"%Y-%m-%d %H:%M:%S"`
#Extract data from the SMS file
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
#Remove plus sign, spaces, minus and short number prefix
TO=`echo "$TO" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed 's/-//g'`
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
TEXT=`sed -e '1,/^$/ d' < $2`
TEXTSQL=$(echo "$TEXT" | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')

#Set some SQL parameters
if [ "$SQL_PASSWORD" != "" ]; then
  SQL_ARGS="-p$SQL_PASSWORD";
  else
    SQL_ARGS="";
    fi
    SQL_ARGS="-h $SQL_HOST -u $SQL_USER $SQL_ARGS -D $SQL_DATABASE -s -e"
   
    #Insert a new entry into the SQL table
   
if [ "$1" = "FAILED" ] || [ "$1" = "SENT" ]; then
     mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent_time,sender,receiver,msgid,text) values (\"$1\",\"$DATE\",\"$FROM\",\"$TO\",\"$3\",\"$TEXTSQL\");";
elif [ "$1" = "RECEIVED" ]; then
     mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent_time,received_time,sender,receiver,text) values (\"RECEIVED\",\"$SENT\",\"$DATE\",\"$FROM\",\"$SUBJECT\",\"$TEXTSQL\");";
elif [ "$1" = "REPORT" ]; then
    #Extract more data from the status report file
    DISCHARGE=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Discharge_timestamp:`
    MSGID=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Message_id:`
    STATUS=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Status: | cut -f1 -d,`
                     
    if [ "$MSGID" != "" ]; then
        ID=`mysql $SQL_ARGS "select id from $SQL_TABLE where receiver=\"$FROM\" and type=\"SENT\" and msgid=\"$MSGID\" order by id desc limit 1;"`
        mysql $SQL_ARGS "update $SQL_TABLE set received_time=\"$DISCHARGE\",status=\"$STATUS\" where id=\"$ID\";"
    fi

fi
                                                   
 
'bash' Syntax Highlight powered by GeSHi


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thank's. I was wondering if in some cases eventhandler never returns and causes hanging. But probably this is not the reason.

You are using internal_combine = yes setting. After the first part of a message was received, this part was handled but then smsd seems doing nothing. Because we do not have a detailed log of a hanging, it's difficult to know what smsd was last doing.

When you are now running with loglevel 7, we just have to wait until the problem occurs again. When that happens, a log file is very important but you could also show the content of a file /var/spool/sms/incoming/GSM1-concatenated. Probably the content is correct, but it's good to check anyway.

Can you locate some last problematic incoming message files? As the message was correct after restarting smsd and receiving the second part, the first part must have something which causes this problem. There is no PDU's stored in the message files, unless you have used store_received_pdu = 3 in the smsd.conf. If there are PDU's, they can be used for debugging. Depending of a message and it's sender, is it possible to re-generate that kind of a message and then get it received to see if the problem is repeated?

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Ups, I forgot to set those PDU files, but I have log records with loglevel = 7:

You can note the problem place by time break. That's the time when I restarted smsd.




« Last edit by keke on Sun Nov 22, 2009 19:23, 182 months ago. »
Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Okay, it seems that there is a bug in the code :(.

I edited your log and will examine this tomorrow morning, currently I'm unable to check this more.

While waiting for the solution, set the global setting in the smsd.conf ic_purge_hours = 0.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
I have tested this issue with your PDU's, but there was no troubles.

Can you show what you had in your /var/spool/sms/incoming/GSM1-concatenated file? Also, is there temporary file still remaining, ls -l /var/spool/sms/incoming/GSM1-concatenated* ? If there is, what is the content?

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
I found that there is two files:

One empty created at 2009-11-22 08:12:42 and another created at 21:04:53:
GSM1.2009-11-22.Yvh7SL:


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Are you probably running 64 bit GNU/Linux and compiler?

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
No, I am not!
The system where SMStools are running (and was compiled) is on PPC system.
But my laptop have 64bit.

It seems a bit strange that I did not get any hangups after changed that settings.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
The setting ic_purge_hours = 0 disabled this feature.

I have to check this on PPC too when it's possible. If I cannot find any reason for this hanging, can I provide a test code for you to run it on your system?

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
You could try.
If it is not very time consuming, than I can try to find time to do that.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Yeah, PPC was the key for this issue. With gcc version 4.3.2 (Debian 4.3.2-1.1) on PPC, the bug was clear and is now fixed. There is 3.1.6 available.

Thank you for the reporting.

Member
Registered:
Oct 2009
Location: Latvia
Topic owner
Thank you for your work!

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.