Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 23 by tttuan: Input Error when locking && timeout=-1
http://code.google.com/p/django-mailer/issues/detail?id=23

What steps will reproduce the problem?
1. Create a send_mail.lock in project dir to test
2. Run mailer via command line: python manage.py send_mail

What is the expected output? What do you see instead?
Expected: inform locking and quit immediately
Actually:
............
   File
"/user/hcm/tttran/bin/pinax-0.5.1/apps/external_apps/mailer/engine.py",
line 47, in send_all
     lock.acquire(LOCK_WAIT_TIMEOUT)
   File
"/user/hcm/tttran/bin/pinax-0.5.1/apps/external_apps/mailer/lockfile.py",
line 266, in acquire
     time.sleep(timeout is not None and timeout/10 or 0.1)
IOError: [Errno 22] Invalid argument


What version of the product are you using? On what operating system?
Version from Pinax 0.5.1
$ uname -a
Linux myserver 2.4.21-47.ELsmp #1 SMP Wed Jul 5 20:30:30 EDT 2006 x86_64
x86_64 x86_64 GNU/Linux


Reason:
- In LinkFileLock.acquire:
     260                     if timeout is not None and time.time() >  
end_time:
     261                         os.unlink(self.unique_name)
     262                         if timeout > 0:
     263                             raise LockTimeout
     264                         else:
     265                             raise AlreadyLocked
     266                     time.sleep(timeout is not None and timeout/10
or 0.1)


If it runs too fast then the time.time() = end_time and the time.sleep will
be executed. The value passed to time.sleep is negative, so it will raise
IOError

acquiring lock...
timeout= -1
time()= 1237789598.54
end_time= 1237789598.54
Traceback (most recent call last):
   File "manage.py", line 26, in <module>
     execute_manager(settings)

Solution:
Use wait variable like in MkdirFileLock.acquire


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to