SMS Server Tools 3
This site is hosted by
Basic information:
Additional information:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

Custom Search

 Visitor locations
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu May 23, 2024 03:11
SMSTools3 Community » Bug reports Bottom

[Fixed in 3.1.16] change sync() to fsync()

Login and Post Reply

Page:  1

Author Post
Jul 2018
Location: QLD, Australia
TL;DR: please change "close(lockfile); sync()" in locking.c to "fsync(lockfile); close(lockfile)".

I just spent many hours chasing down why it was taking SMS tools up to 20 minutes to send a message. It turned out to be because zoneminder (an camera monitoring package) was running on the same machine, and zoneminder was the copious amounts of video data it generates to a USB HDD, which apparently was having issues.

Smstools wasn't using the USB drive in any way, but it does call sync() in locking.c. sync() syncs all drives attached to the machine and does not return until it's done. It turns out it was taking up to 20 minutes to write the buffered video data to this USB drive.

AFAICT there is no reason to do the sync at all. The only reason you do it is to ensure the data is on the disk before telling the user the operation is done, so that if the power fails the user is assured his data is safe. But in this case the thing being synced is a lock file which is deleted on boot, so if the power fails no one will care if it was saved or not. (To contrast, syncing a received SMS to disk before calling the event handler would make some sense). If you insist on sync()'ing it you should use fsync() wish only flushes the data you care about - and doesn't put the performance of your application at the mercy of every other thing the machine is doing at the time.

May 2009
Location: Jyväskylä, Finland
This is fixed in 3.1.16.

Login and Post Reply

Page:  1

SMSTools3 Community » Bug reports Top

Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.