gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread safe usage of multiple phones


From: Peter Koch
Subject: Re: thread safe usage of multiple phones
Date: Tue, 18 Apr 2017 16:50:52 +0200

Dear Pawel:

First let me congratulate you for this wonderful piece of software.
We are using it for almost 10 years. It's rock stable and is sending
notifications to our adminsitrators in situations where emails just
dont' work (or mail to SMS gateways).

Well, for me personally it is quite nice surprise that in the age of
smartphones and API to everything gnokii is still being used :)

We were thinking about other notification mechanisms but so far
a mobile phone that is directly connected to our logserver via serial
cable is the most reliable and secure way to inform us about problems.
 
I do not know how it would behave right now but years ago USB link was
much less reliable than serial one. To translate it to actions: it
required restarting gnokii or even phone sometimes.

We started in 2008 with gnokii-0.6.23, a Nokia 6310 phone and a DLR3P
serial cable. And once in a while we had those instabilities that you
mentioned. Phone and software had to be restarted. Therefore we
changed our software such that every administrator got a single
message every day at 12:00. If this heartbeat-SMS was missing we knew
that there was a gnokii-problem and someone had to restart the phone.

When we changed to gnokii-0.6.30 and connection=AT all these
problems disappeared.

Also, I'm closing the gnokii-connection whenever the messge queue
becomes empty. With a serial connection reopening the connection
is slow but this improved stability very much. I'm hoping that reopening
a connection with USB-connected phones will be a lot faster.

My hope is that multiple phones will add another level of redundancy.
If one phone hangs then messages will be resent by one of the other
phones. Therefore I will keep the Nokia 6310, so if the USB-bus hangs
and all of the USB-connected phones cannot sent SMS anymore at
least the serial connection will work.

So far a Nokia 6230i with CA-53 cable and connection=dku2libusb
seems to work very well with gnokii-0.6.31.

I have looked quickly into the code. In gsm-sms.c just
sms_timestamp_print() seems to be thread non-safe (just in DEBUG mode)

> Can I call gn_sms_send(data1, state1) and gn_sms_send(data2, state2)
> in two threads?

If you do the preparation by yourself, I think that would work fine.
But it would be the best just to try it out. Looks like 1-day
excersise.

I'll do that within the next days

Do you know how to dinstinguish between phones? One queue or multiple queues?

>   get_sms_from_queue(&data);
>   gn_sms_send(data, &state);
> }
>
> Any ideas or suggestions?

The easiest way (that is using gnokii in non-modified form) would be
to run multiple gnokii (or smsd) instances. And then feed them with
round-robin or so.

With multiple gnokii or smsd instances it would be hard to detect
problems in one instance and resent messages that failed on one
phone with a different phone.

The gnokii-part within my own daemon ist almost completely stolen
from your source. There's already a queue that is filled from different
threads that collect messages from different sources. There's one thread
that is feeding all these messages into our Oracle Database. And
there is another thread that is sending urgent messages out to our
administrators. Adding more SMS-threads should be relatively easy.
And if one thread has problems it should put its message back into
the queue and stop itself.

I'm sure that will work for another 10 years :-)

Kind regards

Peter Koch

reply via email to

[Prev in Thread] Current Thread [Next in Thread]