SMS Server Tools 3
This site is hosted by Kekekasvi.com
 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. Please login or register. Thu Dec 05, 2019 17:38
SMSTools3 Community » Help and support Bottom

[solved] Conflict with .LOCK file

  This topic is locked

Page:  Previous  1  2

Author Post
Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thanks.

This kind of error should not happen, but it has happened and I do not understand why. It may have something to do with the filesystem under Cygwin, but still should not happen...

I have created a new version for you:

Hidden private text.


In the case of error, it sleeps and retries twice. The issue is also logged. Now it's important to see if the sleeping and retrying helps, which means that even when smsd is not stopped, you have to grep "fopen write failure" from the log periodically, for example once per day.

Hidden private text.



Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Thank you Keke!
I will install new version ASAP.

Quote
In the case of error, it sleeps and retries twice.

1) What if second attept fails again. Smsd will shut down?
2) How long is sleep intererval?

Hidden private text.



Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
VVV wrote
1) What if second attept fails again. Smsd will shut down?

Yes. Currently we need to see if the problem with a file is permanent or not.

VVV wrote
2) How long is sleep intererval?

First one second and then five seconds. Everything is logged to smsd.log too.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Whether next retries are performed with new file names or the same one?
I am speaking about filename which smsd generates during moving to checked folder.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
VVV wrote
Whether next retries are performed with new file names or the same one?
I am speaking about filename which smsd generates during moving to checked folder.

It's using the same one, because with that name there already is a .LOCK file, and the original file is deleted. This is because it's created using new permissions, different than mkstemp() uses.

I asked some details of number of messages before, because in most cases this error does not happen. Because the filename is random, it makes no sense why in some few cases there is "permission denied" error. The file was just deleted, and perhaps Windows/Gygwin is still wasting a time with the file, causing that the new file cannot be created. With delays I'm trying to catch this, with the original name of a file.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Our usual number of messages = 7-8 K per day. Not very huge. 10 modems.

What is strange to me, that according to last logs presented in this topic, it is clear that problematic file remains in outgoing folder after smsd stop event. Please , look at below fragment:


After manual statup of smsd the same one file is moved from outgoing folder with no issues.

I have also checked that temporary name /var/spool/sms/aus/kjnrFR is not presented ( be used ) in log before.

Quote
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.

Nothing intersting was in logs for these cases. No any fatal smsd errors or troubles.

Quote
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.

Before today's event we had a day when PC had restart events 3 times per day: in 7:30 AM , in 7:30PM and in 7:45PM. It was a usual day with 7.5K messages as total. Our peak hours are 10,11 AM. So between 1st and 2nd restart 7K messages have been processed. between 2nd and 3rd event, only few messages.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thanks for the information.

VVV wrote
What is strange to me, that according to last logs presented in this topic, it is clear that problematic file remains in outgoing folder after smsd stop event. Please , look at below fragment:


After manual statup of smsd the same one file is moved from outgoing folder with no issues.

The first patch fixed this, when there is a problem in the destination directory, original file is not deleted.

VVV wrote
I have also checked that temporary name /var/spool/sms/aus/kjnrFR is not presented ( be used ) in log before.

Okay.

VVV wrote
Quote
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.

Before today's event we had a day when PC had restart events 3 times per day: in 7:30 AM , in 7:30PM and in 7:45PM. It was a usual day with 7.5K messages as total. Our peak hours are 10,11 AM. So between 1st and 2nd restart 7K messages have been processed. between 2nd and 3rd event, only few messages.

Okay, there is no reason to assume that smsd causes restarting. But what is the reason... perhaps we will never find it out... :(


As an addition, there are some other places too in the code, where a file is created like it's done when spooling. Assuming that we will later see that retrying helps, I probably have to add retrying to other places too. This should not be required, but at least in your system there are strange things happening...

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
I have installed new version. Will inform you on new issues.
Thank you for support.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Your new version solves the problem. There was 1 such new event successfully resovled by retry.
Please see log below:


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Are you sure that this is the only one event during 4 days?

How about PC restarts, are they gone too?

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Yes it was only one such event after installation of new version on 04 Mar 2011.
There also were 3 PC restarts but on anotrher days, not 08 Mar 2011.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
I am reporting new event with file move conflict. This one is also successfully resolved by new version of smsd after 1 retry:



Thank you for support!

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thanks.

What smsd does, is:

1) It creates a file with random unique name. This has never failed.

2) File is closed and removed, because it has permissions 0600, and usually 0644 is required.

3) File with the same name is created using another function, which sets permissions to 0644, and returns a file pointer instead of file descriptor which is important for the code. This has never failed on Unix/Linux systems. For some reason in your Cygwin this sometimes fails, but not very often. The error "13: Permission denied" is strange, as the file was just deleted. Perhaps the Cygwin or Windows is somehow slow, and internal conflict in directory structure causes the error. But I cannot know for sure what is the actual reason. After one second the same function does not get "permission denied", even when the name of a file is the same.

Within a next few days I try to publish a new custom version for you, including slightly changed file creation on other places too. This version will also retry on failure. Because you are sending lot of messages, I try to include some other changes too, which will slightly improve the speed of sending.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
keke,
below are new events successfully resolved by your new version:



Thank you very much for your support.
Our system is stable now.

PS
PC restarts disappeared after disabling windows and symantec update services. :)

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
VVV wrote
Our system is stable now.

Good, but there is still something strange with that error. I tried to reproduce this issue on PIII 866 running XP, but without results. Using 10 simulated modems and 100.000 messages the error did not happen.

I have been too busy to produce the next custom version for you, sorry. But for the error you have not needed it. For improved speed of sending, I would first like to know how many messages you are sending on peak hour, with single modem, and what is the typical sending time. And what is your current smsd.conf.

VVV wrote
PC restarts disappeared after disabling windows and symantec update services. :)

Oh yeah :P

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
During peak hours one modem sends 180-210 messages per hour.
There are 9-10 modems in our system for now.
Whole message volume during a day : 8000+ sent , 2500 received.
typical sending time ... i have no idea how to calculate.
few values from log : 6 , 8 , 10 , 25 sec.
Sometimes I see : "Took 2.0 seconds to get a file /var/spool/sms/..., lost 0 times, 1 SMS files and 0 LOCK files seen." message in trouble.log
Same server receives e-mails , put them in mysql, runs mysql, runs smsd , sends incoming sms via e-mails. May be this is the cause of slow down from time to time.

Below is smsd.conf
Hidden private text.



By the way, one new issue has been noticed by our support staff.
It had happened only once several days ago.
One of modems has stopped any activity ( no errors or any related records in logs ).
One last record in smsd.log states that modem has sent sms succesfully.
There are no records in any log regarding this modem after that.
No record about modem process termination too.
After stop/start of smsd several days later, modem works fine.
During stop smsd , no record about termination of modem process for that modem.
Unfortunately I have no information, whether modem process was running before smsd stopping, but it seems to me - no.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
If you enable statistics feature, you can get files which tell how much messages are handled in the defined time. Also you will get a status file which tells what modems are doing and when the latest activity has started.

Here is an instruction from another topic:
Quote
First you have to install gcc-g++: C++ compiler on Cygwin. It's under a Devel section.

Then download OSSP mm Shared Memory Library from this site. Current version of a library is 1.4.2. The package has a file named INSTALL which should be read.

On Cygwin you can run ./configure --prefix=/usr to start configuration. Then ensure that testing of a library goes successfully. After you do not get any errors, the library can be installed.

Then edit a Makefile in the smstools3/src directory. Locate the following and comment out the line as instructed:
# Comment this out, to enable statistics
#CFLAGS += -D NOSTATS


Save the Makefile and run make clean smsd. You should now have a status monitor activated.

When statistics feature is enabled, add a global setting to the configuration:

stats = /var/spool/sms/stats

See stats and other settings related to statistics.

If you get only few "Took n.n second" messages, it's not a big problem. Windows and other tasks just eat all processor time, and smsd goes slow.

If a modem process is killed hardly with SIGKILL (-9), it does not write anything to the log. However, I assume that this signal was not used. As there was a message about sending, and then nothing, I'm not sure about the reason for this issue. Probably the serial driver freezed, but it cannot be known for sure. If this issue repeats, check from the ps list what process id's are listed, and from the log what processes were started.

Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Keke,
Thanks again for information about statistics feature. I will implement it in my setup soon.

Please help me with new question. My conf file you can see in this topic.
I use queues feature. In particular, queue with name "dummy" is used to switch modem to receive-only mode. Few days ago we have configured one of modems with such options :
[M2]
device = /dev/com2
queues = dummy
'smsdconf' Syntax Highlight powered by GeSHi

As expected , no messages were moved to dummy folder during sending ( i see in log ). However this modem continued to send messages from time to time. In log I see that it took them from checked folder. Why? Is it the feature of new version of smsd? I use checked folder in definition for one of my queues. Is it correct?
Many thanks in advance.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
VVV wrote
I use queues feature. In particular, queue with name "dummy" is used to switch modem to receive-only mode. Few days ago we have configured one of modems with such options :
[M2]
device = /dev/com2
queues = dummy
 
'smsdconf' Syntax Highlight powered by GeSHi


As expected , no messages were moved to dummy folder during sending ( i see in log ). However this modem continued to send messages from time to time. In log I see that it took them from checked folder. Why? Is it the feature of new version of smsd? I use checked folder in definition for one of my queues. Is it correct?

"checked" folder can be used.

But there is a bug in the code :oops: :(. When queues are read in the modem section, values inherited from default section are not cleared. This causes that with [default] queues = aus, main, dummy, M2 will serve dummy, main, dummy, and some other modems will serve like the default says, because queues = aus does not change anything. I will fix this in the next version, of course, but in the meanwhile define queues for all modems and do not define queues in default section.

Or if you want to, you can apply the fix right now: file smsd_cfg.c:

                if (strcasecmp(name,"device_open_alarm_after")==0)
                  NEWDEVICE.device_open_alarm_after=atoi(ask_value(NEWDEVICE.name, name, value));
                else
                if (strcasecmp(name,"queues")==0)
                {
                  ask_value(NEWDEVICE.name, name, value);

                  // 3.1.15: Fix: Forget previous values (from [default] section):
                  for (j = 0; j < NUMBER_OF_MODEMS; j++)
                    NEWDEVICE.queues[j][0] = 0;

                  // 3.1.5: special queuename:
                  if ((p = strstr(value, "modemname")))
                  {
                    if (strlen(value) -9 +strlen(device_name) < sizeof(tmp))
                    {
                      sprintf(tmp, "%.*s%s%s", (int)(p -value), value, device_name, p +9);
                      strcpy(value, tmp);
                    }
                  }

                  // Inform if there are too many queues defined.
 
'c' Syntax Highlight powered by GeSHi


Member
Registered:
Jun 2009
Location: Russian Federation
Topic owner
Thank you keke for fast response !

I will change modem sections for now.

  This topic is locked

Page:  Previous  1  2

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.