Description
On a page with multiple attachments (PNGs, in my case), some of them (in random order on each reload) won't display.
Duplicate of MoinMoinBugs/RandomLockAlreadyReleased.
Steps to reproduce
- attach some image-files (PNGs in my case) to a page;
call these attachments through {{attachment:f01.png}}
- after saving (and during the preview) the page some of the pictures don't display while others do, but I could never get all the figures (totaling 12) displayed simultaneously on the page.
NOTE: I couldn't figure out a rule which pictures display and which don't -- it's really random with each reload of the problematic page; a "Delete Cache" doesn't help either.
Example
{{attachment:f01.png}} ... TEXT, TEXT, TEXT {{attachment:f0203.png}} ... TEXT, TEXT, TEXT ... TEXT, TEXT, TEXT {{attachment:f0405.png}} ... TEXT, TEXT, TEXT {{attachment:f0608.png}} ... TEXT, TEXT, TEXT {{attachment:f0911.png}} ... TEXT, TEXT, TEXT etc.
Component selection
- general
Details
The following error messages appear in the command prompt after the "GET" request for each picture that fail to display:
2008-07-21 16:02:36,730 INFO MoinMoin.server.server_standalone:290 127.0.0.1 "GET /TestPage?action=AttachFile&do=get&target=f01.png HTTP/1.1" 304 - 2008-07-21 16:02:36,792 ERROR MoinMoin.caching:190 Can't acquire read/write lock in D:\Documents and Settings\me\Desktop\moin-1.7.1\wiki\data\cache\__common__\ session\__lock__ 2008-07-21 16:02:36,792 INFO MoinMoin.server.server_standalone:290 127.0.0.1 "GET /TestPage?action=AttachFile&do=get&target=f0405.png HTTP/1.1" 500 - 2008-07-21 16:02:36,822 ERROR MoinMoin.failure:159 An exception occured. Traceback (most recent call last): File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\request\reques t_standalone.py", line 60, in __init__ RequestBase.__init__(self, properties) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\request\__init __.py", line 212, in __init__ user_obj = self.cfg.session_handler.start(self, self.cfg.session_id_handler) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\session.py", l ine 390, in start sessiondata = self.dataclass(request, session_name) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\session.py", l ine 108, in __init__ self._data = self._ce.content() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\caching.py", l ine 257, in content self.close() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\caching.py", l ine 220, in close self._lock.release() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\util\lock.py", line 333, in release return ReadLock.release(self) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\util\lock.py", line 123, in release raise RuntimeError("lock already released") RuntimeError: lock already released 2008-07-21 16:02:36,980 ERROR MoinMoin.caching:190 Can't acquire read/write lock in D:\Documents and Settings\me\Desktop\moin-1.7.1\wiki\data\cache\__common__\ session\__lock__
MoinMoin Version |
Release 1.7.1 (apparently all releases > 1.5.5a, see below) |
OS and Version |
Windows XP SP2 |
Python Version |
ActivePython 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] |
Server Setup |
N/A |
Server Details |
DesktopWiki, launched through double-clicking wikiserver.py |
Language you are using the wiki in (set in the browser/UserPreferences) |
N/A |
Affected MoinMoin versions: 1.6.3, 1.6.8, 1.7.0, 1.7.1 (bugreport), 1.7.2, ...
Workaround
Unknown.
Discussion
It is really striking that the images fail to appear on page randomly, i.e. I was unable to see any pattern regarding this misbehavior until now. I have reproduced this bug with previous MoinMoin releases (1.6.3, 1.7.0) and different Python versions (2.5.2 and 2.4.5 from python.org).
Looks like SurgeProtection is "working"; see HelpOnConfiguration/SurgeProtection -- MarcelHäfner 2008-07-21 14:46:53
- this can be easily verified by disabling surge protection
Thanks, Marcel! Disabling SurgeProtection fixed the figure display problem. However, the lock error messages remained in the log (details below).
UPDATE: I could report partial progress -- apparently things still don't work as expected when I am logged into my account. In order to get all the images displayed properly, I had to log out, to delete page cache (through the "More actions" menu), and to reloaded the page several times. This fix was also not long-lasting.
RE-UPDATE: Unfortunately, things only seemed to have been fixed. Soon after I reported the success above, the images started to disappear at random again. Failing to obtain meaningful and/or replicable results, I tried the last of the dedicated MoinMoin DesktopEdition builds (file moin-desktop-1.5.5a-1.zip from http://sourceforge.net/project/showfiles.php?group_id=8482&package_id=151797) and I can say that after correcting the attachment syntax, everything works just fine. Therefore I assume that there's a regression affecting all the MoinMoin versions newer than 1.5(.x).
- this can be easily verified by disabling surge protection
- I think it is a problem of the locking code, likely a win32-only problem. Someone using windows has to debug this, See also the questions in some other windows (cache) locking bug reports.
I'll try to test on a Linux system to verify if this is win32-only. How about creating a /TestPage here?
- I have created a test page as suggested and everything seems to be working OK here.
Does that /TestPage content reproduce the problem on windows? -- ThomasWaldmann 2008-10-06 17:32:49
- I have created a test page as suggested and everything seems to be working OK here.
- The following still appears in the command prompt, hinting at problems with the locking code:
2008-07-22 09:47:02,296 ERROR MoinMoin.caching:277 Can't acquire write lock in D :\Documents and Settings\me\Desktop\moin-1.7.1\wiki\data\cache\__common__\sessi on\__lock__ 2008-07-22 09:47:02,687 ERROR MoinMoin.failure:159 An exception occured. Traceback (most recent call last): File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\request\reques t_standalone.py", line 60, in __init__ RequestBase.__init__(self, properties) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\request\__init __.py", line 212, in __init__ user_obj = self.cfg.session_handler.start(self, self.cfg.session_id_handler) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\session.py", l ine 416, in start sessiondata = self.dataclass(request, session_name) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\session.py", l ine 108, in __init__ self._data = self._ce.content() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\caching.py", l ine 257, in content self.close() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\caching.py", l ine 220, in close self._lock.release() File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\util\lock.py", line 333, in release return ReadLock.release(self) File "D:\Documents and Settings\me\Desktop\moin-1.7.1\MoinMoin\util\lock.py", line 123, in release raise RuntimeError("lock already released") RuntimeError: lock already released
coincidentally, I just ran across this page by accident while Googling for how to show an attachment. I am running MoinMoin Personal Edition on win32 and am seeing the same locking issue. I see the same behavior on 2.5.2 and 2.6. Deleteing the __lock__ folder in wiki\data\cache\wikiconfig\wikidicts seems to temporarily solve the problem. Also right now, it's only happening on one machine for me (my work PC) so I don't know what is going on. I'll try to take a look at the problem and post more details if I find them. -- ShawnWheatley We need a python developer on windows for fixing lock related issues on this platform or an example page and a description how to trigger the problem, see status -- ReimarBauer 2008-11-06 22:28:43
Plan
- Priority:
- Assigned to:
Status: workaround by http://hg.moinmo.in/moin/1.8/rev/d85005213fd9 - please test!
Tested, failed — (28.11.2008 SK)
please upload a zipped complete page dir, including images and make sure the bug reproduces with the description given above and the code of rev d85005213fd9 or later (that code definitely fixed related problems I found while working with moin under windows a few weeks ago). I have to work on a windows machine until tuesday, so if I get a test case to reproduce it, I can maybe fix it. -- ThomasWaldmann 2008-11-28 17:59:20
I have been watching this page hoping for a resolution to this issue. I have upgraded to 1.8.1 which indicates it might help with this, but I continue to experience issues. I dont see that anyone has given an example page so I will contribute one. Example.zip .. ClintBennion
Thanks for contributing an example page, that'll hopefully make it easier to reproduce. I'll test it on a Linux system first and on some windows system also (as soon as I have access to one again). -- ThomasWaldmann 2009-02-14 03:54:19
Test on my Linux-only laptop didn't show any problem, I unpacked the zip to my data dir und reloaded it a dozen times in the browser. No missing images, everything fine. I used ./wikiserver.py and Firefox 3.0.6 to test. -- ThomasWaldmann 2009-02-14 04:12:51
Did another test on Linux, faking sys.platform = 'win32', so it executes our non-posix locking code, but it works with that also. Looks like I need either windows or more details about how to reproduce. -- ThomasWaldmann 2009-02-14 04:32:03
- SK: please subscribe to this page
I'm currently abroad and short in time, hopefully this improves next week. FYI: I copied the two files mentioned in http://hg.moinmo.in/moin/1.8/rev/d85005213fd9 into my moinmoin directories (replacing the old files) and deleted the corresponding .pyc-files, restarted Apache and opened the page. Still randomly missing images. (SK)
Trying to reproduce on Windows Vista (NTFS) on a C2D 1.8GHz Laptop, FF 3.0.7, IE7 (also installed: Antivir, Adblock Plus (FF)):
- downloaded and installed python 2.6.1 and moin 1.8.2
- extracted Example.zip to the pages dir
- started ./wikiserver.py
- accessed the page about 20 times with FF and with IE
- kept hitting F5 (reload) and also clicked shift-reload
- I can't reproduce the problem! I get all images and I don't get tracebacks.
-- ThomasWaldmann 2009-03-15
Thank you for your efforts. I know how difficult(impossible) it is to fix something when it is not possible to reproduce. System information
- Microsoft Windows Server 2003 - Service Pack 2
- Intex XEON MP (Quad Core) 2.0 Ghz
- Python 2.5.2 and moin 1.8.1
- FCGI 2.4.1 (I have removed this in the past to see if it helped but it didn't so I put it back on.)
McAfee Virus Scan Enterprise 8.5
I noticed something today. I was testing from home over a VPN and I only got it to fail once in close to 30 tries. I then used Remote Desktop onto the server machine. It failed every time using both FireFox 3.0.6 and Windows Explorer 6. The laptop that is succeeding over the VPN was failing when I was in the office. This leads me to believe that using the VPN is slowing the requests for the images, allowing the server to respond successfully.
I am not sure how best to help resolve this issue but am happy to assist in whatever way I can. I will look to see if I can figure out how to generate a Traceback. So far I have only found errors in the Webserver log files which aren't detailed enough to help resolve why it is happening.
-- Clint Bennion 2009-03-16
I'm supplying additional info on this bug.
Moin is running on an XP SP3, Apache 2.0 with the wsgi plugin.
SystemInfo ---------- Python Version 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] MoinMoin Version Release 1.8.2 [Revision release] Number of pages 684 Number of system pages 195 Accumulated page sizes 2222.0 KiB Disk usage of C:\WEB\wiki1\wiki\data/pages/ 305.8 MiB Disk usage of C:\WEB\wiki1\wiki\data/ 325.0 MiB Entries in edit log 123 (12.1 KiB) Event log 210.0 KiB Global extension macros AbandonedPages, Action, AdvancedSearch, AttachInfo, AttachList, BR, EditTemplates, EditedSystemPages, EmbedObject, FootNote, FullSearch, FullSearchCached, GetText, GetText2, Hits, Include, InterWiki, LikePages, MonthCalendar, Navigation, NewPage, OrphanedPages, PageCount, PageHits, PageList, PageSize, RandomPage, RandomQuote, RecentChanges, ShowSmileys, StatsChart, SystemAdmin, SystemInfo, TableOfContents, TeudView, Verbatim, WantedPages, WikiConfig, WikiConfigHelp Local extension macros NewMonthCalendarEntry, HTML, Include, MonthCalendar2, Gallery, TodayLink Global extension actions AttachFile, CopyPage, DeletePage, Despam, LikePages, Load, LocalSiteMap, MyPages, PackagePages, RenamePage, RenderAsDocbook, Save, SpellCheck, SubscribeUser, SyncPages, backup, bookmark, cache, chart, diff, dumpform, edit, fckdialog, fullsearch, info, links, login, logout, newpage, pollsistersites, quicklink, quickunlink, recoverpass, refresh, revert, rss_rc, serveopenid, showtags, sisterpages, sitemap, subscribe, supplementation, thread_monitor, titleindex, unsubscribe, userprefs, userprofile Local extension actions userform, RenderAsOpenDocument Global parsers text, text_cplusplus, text_creole, text_csv, text_diff, text_docbook, text_html, text_irssi, text_java, text_moin_wiki, text_pascal, text_python, text_rst, text_xslt Local extension parsers html, text_html, gnuplot Xapian search Enabled, Xapian 1.0.6, index available, last modified: 2009-04-14 10:24:18 Stemming for Xapian Disabled (danish dutch english finnish french german german2 hungarian italian kraaij_pohlmann lovins norwegian porter portuguese romanian russian spanish swedish turkish) Active threads 1
Logging set to DEBUG level. (Logging to stdout and Apache's piped to syslog
2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] 2009-04-15 19:47:18,260 MoinMoin.failure ERROR An exception occurred, URI was \"/wiki/bblog/2009-02-14?action=AttachFile&do=get&target=IMG_3972.jpg\". 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] Traceback (most recent call last): 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\request\\\\request_wsgi.py\", line 35, in __init__ 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] RequestBase.__init__(self, {}) 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\request\\\\__init__.py\", line 212, in __init__ 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] user_obj = self.cfg.session_handler.start(self, self.cfg.session_id_handler) 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\session.py\", line 394, in start 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] sessiondata = self.dataclass(request, session_name) 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\session.py\", line 108, in __init__ 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] self._data = self._ce.content() 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\caching.py\", line 252, in content 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] self.close() 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\caching.py\", line 215, in close 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] self._lock.release() 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\util\\\\lock.py\", line 340, in release 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] return ReadLock.release(self) 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] File \"C:/WEB/wiki1/moin-1.8.2\\\\MoinMoin\\\\util\\\\lock.py\", line 129, in release 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] raise RuntimeError(\'lock already released: %s\' % self.lockDir) 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] RuntimeError: lock already released: C:\\\\WEB\\\\wiki1\\\\wiki\\\\data\\\\cache\\\\__common__\\\\session\\\\__lock__\\\\read_lock_ 2009-04-15 19:47:19 kolja daemon.err [Wed Apr 15 19:47:18 2009] [error] 2009-04-15 19:47:18,276 MoinMoin.util.lock DEBUG acquired exclusive lock: C:\\\\WEB\\\\wiki1\\\\wiki\\\\data\\\\cache\\\\__common__\\\\session\\\\__lock__\\\\write_lock
It doesn't matter if Moin is run as CGI or wsgi. The problem only appears on XP not Linux. It seems to be a timing problem. The faster network, the more frequent.
Jan Claréus 15/4-09
Another try to fix it
What we learn from this is that doing an "atomic rename" on Win32 is total crap:
If you run >= Vista / Server2008, the new code now is maybe able to do an atomic session file update (sometimes needing some retries).
If you run some older Windows >= 2000, it seem to need some luck to succeed, as it is only pseudo-atomic (sometimes needing some retries).
- If even that is not supported, there is no way to do it atomically, so it'll fail sometimes.
To summarize:
- 0 lines of code needed for Posix (Linux, Mac OS X, BSD) atomic rename, works, ever, everywhere.
- 100 lines of code needed to make it "work" on Windows, sometimes, somewhere.
Likely this set of patches will make the session file update problem happen less often, due to lower session file updating frequency (like when loading lots of attached images on a page, trail doesn't change for that case, so session file doesn't need to be updated):
I am happy to report: Since upgrading to the latest release earlier this month I have not experienced any issues. When I upgraded I also switched to using WSGI from Fast CGI. Several of my pages never showed all the images before, so this is a big improvement. Thank you for your good work! - ClintBennion