|
|
SMS Server Tools 3 Community |
Welcome, Guest. Please login or register. |
Fri Apr 19, 2024 03:08 |
This topic is locked
Page: 1 2 Next
Author |
Post |
|
#1 Tue Feb 15, 2011 15:26, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
|
Operating System: Windows XP SP3 Version of smsd: 3.1.14 Smsd installed from: sources Name and model of a modem / phone: Siemens MC 35 Interface: serial I have upgraded recently to v.3.1.14 from 3.0.10. Whole system works perfectly, but I noticed one trouble. Several times per day I see the following error in smsd.log : I am unable to understand why "Conflict with .LOCK file in the spooler" occured. /var/spool/sms/aus/ is one of my queue folders. None of my scripts writes something into that folder except smsd itself. I have configured smsd with keep_filename = no. Please help.
|
|
#2 Wed Feb 16, 2011 10:34, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Why the isssue is important:
As can be seen from the log, conflict is not fatal. smsd continues to work. And one second later it moves the file (2994468.txt) from outgoing folder to queue. But this file is not processed by any modem anymore. And the file does not exist in queue folder.
As a result, this message is not sent and no feedback from any modem about failure ( eventhandler ).
|
|
#3 Thu Feb 17, 2011 11:48, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
I was able to reproduce this issue on Windows/Cygwin, with 10 simulated modems and couple of hundred messages. Because of slow filesystem, some new files in the queue directory were handled by the modem process, before mainprocess completed the spooling. This was also tested on GNU/Linux, with 10 modems and 10000 messages. With GNU/Linux there was no any conflicts, and no any delays. Before the latest change was released, it was tested with 64 modems and 15000 files, successfully. But not under Windows/Cygwin... However, spooling can be enhanced, and there is also a bug when moving of file fails. This caused that the original file was deleted in the case of conflict Here is the patch which will fix your current problem: diff -Naur 3.1.14/src/extras.c smstools3/src/extras.c --- 3.1.14/src/extras.c 2010-09-21 12:15:45.000000000 +0300 +++ smstools3/src/extras.c 2011-02-17 11:39:54.000000000 +0200 @@ -314,7 +314,9 @@ } else { - unlink(filename); + if (!result) // 3.1.15: do not delete in case of errors + unlink(filename); + if (newfilename) strcpy(newfilename, newname); } @@ -585,6 +587,10 @@ continue; }
+ // 3.1.15: Skip empty files: + if (!statbuf.st_size) + continue; + files_count++;
// 3.1.12: 'diff' Syntax Highlight powered by GeSHi
|
|
#4 Thu Feb 17, 2011 12:13, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Thank you very much Keke for your kindly support !
Please excuse me , I have no expirience how to apply such patches. Where I can find information about that ?
|
|
#5 Thu Feb 17, 2011 12:17, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Save it as /tmp/patch, then:
cd smstools3/src patch < /tmp/patch
Then recompile and replace the /usr/local/bin/smsd.exe.
|
|
#6 Fri Feb 18, 2011 10:46, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
I have received the following output from patch command : Is it OK?
|
|
#7 Fri Feb 18, 2011 10:57, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Not ok. 587 is where the second change should start. Probably your /tmp/patch was stored incorrectly. Edit the file extras.c. Locate those two places, and check if the patch is correct (highlighted). If it's not, just change it by hand. if (!unlockfile(newname)) { unlink(newname); if (!result) result = 3; } else { if (!result) // 3.1.15: do not delete in case of errors unlink(filename);
if (newfilename) strcpy(newfilename, newname); }
return result; } }
char *cutspaces(char *text) { 'c' Syntax Highlight powered by GeSHi if (!i) { locked_count++; continue; }
// 3.1.15: Skip empty files: if (!statbuf.st_size) continue;
files_count++;
// 3.1.12: //if (trust_directory || !islocked(tmpname)) {... if (islocked(tmpname)) continue;
sprintf(storage_key, "*%s*\n", tmpname); 'c' Syntax Highlight powered by GeSHi
|
|
#8 Fri Feb 18, 2011 11:36, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Thank you !
the problem resolved!
|
|
#9 Mon Feb 21, 2011 10:29, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Hi Keke, I still have some issues with new version even after above patch. Issue 1) Happens very rare. Once per few days. Fatal error of smsd. The log is: Question #1 ----------- What is strange for me : I use option " keep_filename = no" and usually system changes filename during such moving: 2011-02-19 15:02:11,5, smsd: Moved file /var/spool/sms/outgoing/ 3016811.txt to /var/spool/sms/aus/ DfoTRRBut in case of fatal error I don't see changed name in the log: 2011-02-21 07:42:14,2, smsd: Fatal error: Cannot move /var/spool/sms/outgoing/3017015.txt to /var/spool/sms/aus. Check file and dir permissions. Is it a bug or feature? Question #2 ----------- I have some idea why fatal error happens. Please review my considerations. I have external script writing new messages into outgoing folder from MysQL. This script is scheduled to run every minute. Sometimes ( very rare ) smsd starts to move files from outgoing folder before above mentioned script to write all files. In case of fatal error the file is "locked" by my script for writing and smsd has trouble with moving. Are my considerations correct? If yes, I ask you please to help me with implementing the following solution. In scuh case to modify smsd code to not generate "Fatal error", because error is temporary and should not occur few seconds later. Is it possible? What piece of smsd code should be modified for that? Issue 2) Conflict with .LOCK file is now NOT occured after your patch. But now few times per day I see the following issue. Please see log file: // smsd.log // trouble log Questions: ---------- Smsd reports that it moved file succesfully but modem process is unable to read it. I don't understand why. Also it is unclear for me why in this case eventhandler is fired for SENT event?
|
|
#10 Tue Feb 22, 2011 10:47, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
VVV wrote Question #1 ----------- What is strange for me : I use option "keep_filename = no" and usually system changes filename during such moving: 2011-02-19 15:02:11,5, smsd: Moved file /var/spool/sms/outgoing/3016811.txt to /var/spool/sms/aus/DfoTRR But in case of fatal error I don't see changed name in the log: 2011-02-21 07:42:14,2, smsd: Fatal error: Cannot move /var/spool/sms/outgoing/3017015.txt to /var/spool/sms/aus. Check file and dir permissions.
Is it a bug or feature?
It's a feature, but probably I change it in the next version. This error has been very unusual, and that information was never needed. VVV wrote Question #2 ----------- I have some idea why fatal error happens. Please review my considerations. I have external script writing new messages into outgoing folder from MysQL. This script is scheduled to run every minute. Sometimes ( very rare ) smsd starts to move files from outgoing folder before above mentioned script to write all files. In case of fatal error the file is "locked" by my script for writing and smsd has trouble with moving. Are my considerations correct? If yes, I ask you please to help me with implementing the following solution. In scuh case to modify smsd code to not generate "Fatal error", because error is temporary and should not occur few seconds later. Is it possible? What piece of smsd code should be modified for that?
Can you show the code which generates outgoing files? If you can show it as it is, I can check and test it on my environment. VVV wrote Questions: ---------- Smsd reports that it moved file succesfully but modem process is unable to read it. I don't understand why. Also it is unclear for me why in this case eventhandler is fired for SENT event?
I have to check this more deeply later. SMS was sent successfully, because of this the file was handled as SENT, but it seems that smsd was not able to write to the file.
|
|
#11 Tue Feb 22, 2011 11:34, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
the script for my Question #2 is simply Windows bat file called MySQL stored procedure: This bat file is scheduled by windows task scheduler to run every minute. Stored procedure inside MySQL walks through message table and writes each new message to a file. Below are MySQL procedures.
|
|
#12 Tue Feb 22, 2011 11:53, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Your consideration in case of fatal error was correct.
The procedure sp_sendsms_message creates a file without a lock file. Because of this, smsd starts handling as soon as the file was seen.
There are some possibilities to fix this. The procedure could create a file with extension '.LOCK' instead of '.txt'. After the file is complete, it could be renamed from xxx.LOCK to xxx.txt. This ensures that smsd will not try to handle incomplete files. Hopefully this can be done, but if not, I'll try to explain another solution.
|
|
#13 Tue Feb 22, 2011 12:07, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Is it a feature of smsd to skip files with .LOCK extension? If yes , I will modify my code the way you proposed.
|
|
#14 Tue Feb 22, 2011 12:17, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
VVV wrote Is it a feature of smsd to skip files with .LOCK extension? If yes , I will modify my code the way you proposed.
Yes it is. Files can also be created to the temporary directory (in the same partition), and after the file is complete, it can be moved to the outgoing directory. With this method .LOCK files or renaming is not required.
|
|
#15 Tue Feb 22, 2011 12:29, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Ok, thanks a lot
|
|
#16 Wed Feb 23, 2011 12:58, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Unfortunately change of file processing doesn't help with this issue. I have reconfigured system yesterday to place sms files in different folder, and next move them in outgoing folder. My new bat file looks : Even with such processing smsd has encountered fatal error today: After that , system has been manually started again and it works fine : You can see that suspicious file has been moved successfully after restart. I ask you please consider my initial proposal : to change smsd code and not generate fatal error in above case. simply skip file temporarily.
|
|
#17 Wed Feb 23, 2011 17:52, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
VVV wrote I ask you please consider my initial proposal : to change smsd code and not generate fatal error in above case. simply skip file temporarily.
It's not that simple. Fatal error is the consequence rather than the cause for the problem. I would like to see what actually and exactly is causing the problem, and then fix what can be fixed. I have made a special version of smsd for you. Please download, compile and run it, until the fatal error happens next time. Right after smsd has stopped, in the trouble log there should be explained what has happened. I'll wait to see it. The link for the package is in the private block: Hidden private text.
|
|
#18 Thu Feb 24, 2011 08:10, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Ok I will do. Whether preivious patch is also in the package?
|
|
#19 Thu Feb 24, 2011 10:30, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
VVV wrote Whether preivious patch is also in the package?
Yes, of course.
|
|
#20 Thu Feb 24, 2011 17:57, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
As soon as you have any results with the special version of smsd, please let me know and see the log. And at this stage, please do not make any other changes to the system.
|
|
#21 Fri Feb 25, 2011 07:53, 160 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
I have installed new version yestrday and have now the following results. Near mid of day PC has hunged up and didn't respond to any commands. we noticed we could no longer connect to the SMS database from our workstations. I couldn't even ping the SMS server. I put a monitor on the server and it was frozen at the desktop. I couldn't get it back to life so I had to reboot the server. After reboot everything worked as normal. No messages in the windows event viewer as to why it crashed. below is a smsd log : and trouble log Hidden private text. the same picture is for our scheduled task running every minute. last succesfull execution at 15:20 and silence after that. Very strange... « Last edit by keke on Thu Mar 03, 2011 16:23, 159 months ago. »
|
|
#22 Fri Feb 25, 2011 13:16, 160 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Bad to say what caused that freezing. It can be anything, starting from hardware failure, etc...
Latest messages 3052944.txt, 3052945.txt and 3052946.txt likely were sent successfully, and there probably was no ...47.txt existing when the freezing happened. Can only look forward if the problem occurs again, or something else happens (fatal error by smsd).
|
|
#23 Thu Mar 03, 2011 13:02, 159 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Since installation of special smsd version, we had no smsd stop events so far. However from time to time we had unexpected PC restart events. Not sure whether they are relate to new version or not. I will inform you once stop event will be captured.
|
|
#24 Thu Mar 03, 2011 17:36, 159 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
When the PC restarts, what is in the logs at that time? As you have had several restarts, it could be good to see the logs from all restarts, if possible.
Another point: between restarts of PC, how much messages were spooled by smsd? Actual number is not important, but magnitude, is it just couple, about hundred, some hundreds, or even thousands, or more.
|
|
#25 Fri Mar 04, 2011 08:29, 159 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
We got it! today smsd has stopped with file conflict error. Please see below logs smsd.log : trouble.log
|
This topic is locked
Page: 1 2 Next
Time in this board is UTC.
|
|
|
|
|
|
|