I built an application that collects error-messages from different sources, inserts them into an Oracle Database and also sends high-priority messages via SMS to our administrators. Of course I'm using Gnokii for the sms part.
For technical reasons I am using the Gnokii library directly.
My appliations works well but about once a month it hangs. So I compiled it with debug-information, started it again and waited for the moment it would hang again. This time I had to wait 7 weeks and about 600 SMS
were sent during that time. Today it happened again.
Here's the gdb backtrace of the thread that does the SMS sending.
Thread 3 (Thread 0xb3a2db70 (LWP 19104)): #0 0xb570ae01 in read () from /lib/libc.so.6
#1 0xb5810824 in serial_read (fd=6, buf=0xb3967dc3, nbytes=245, state=0x9c1f0f0) at unixserial.c:415 #2 0xb57b9d9f in device_read (buf=0xb3967dc3, nbytes=245, state=0x9c1f0f0) at device.c:183 #3 0xb580c855 in send_command (cmd=<value optimized out>, len=<value optimized out>, state=0x9c1f0f0) at fbus.c:118
#4 0xb580c966 in at2fbus_serial_open (state=0x9c1f0f0, type=GN_CT_Serial) at fbus.c:156 #5 0xb580d9f4 in fbus_initialise (attempt=0, state=0x9c1f0f0) at fbus.c:717 #6 0xb57eeb48 in NK6510_Initialise (op=GN_OP_Init, data="" state=0x9c1f0f0) at nk6510.c:598
#7 NK6510_Functions (op=GN_OP_Init, data="" state=0x9c1f0f0) at nk6510.c:395 #8 0xb57b51d8 in register_driver (model=0x9c1f0f4 "6310", setupmodel=0x0, sm=0x9c1f0f0, driver=<value optimized out>) at gsm-api.c:117
#9 0xb57b5404 in gn_gsm_initialise (sm=0x9c1f0f0) at gsm-api.c:159 #10 0xb57b47e2 in gn_lib_phone_open (state=0x9c1f0f0) at libfunctions.c:188 #11 0x0804cf0f in gnokii_send (sp=0x9c62480) at syslog2ora.c:1236 #12 0x0804d2ad in send_sms (arg=0x0) at syslog2ora.c:1306
#13 0xb562cc04 in start_thread () from /lib/libpthread.so.0 #14 0xb571c02e in clone () from /lib/libc.so.6
Since opening the phone lasts for a couple of seconds I'm trying to avoid this as much as possible. Unfortunately Gnokii looses its connection with my
Nokia 6510 if no SMSs were sent for more than 60 seconds. Therefore I open the phone, sent as much SMS as possible and then close the device after 10 seconds of inactivity.
I expected my application to hang during SMS-sending, but it seems to hang in gn_lib_phone_open().
So here are my questions: - Any ideas what might cause this? - I'm using Gnokii 0.6.30. Will 0.6.31 make any difference? - Why is gnokii doing a read() call that blocks forever? - What would happen, if I replace the read() call in unixserial.c by something
that will timeout after 60 seconds and return -1? - Should I replace the Nokia 6510 and the serial cable by something more stable?