Description
MoinMoin breaks with error:
TypeError: cannot deepcopy this pattern object
Steps to reproduce
- update from 1.3.5 to 1.5.0
I also got this only after reinstalling German.zip from SystemPagesSetup. All other wikis that I have (farmconfig installation) work well. Py 2.3.4.
Example
http://wiki.garagies.de/moin.py/SystemPagesSetup
Details
It does not seem to be a permission problem because making all the directories and files world read/write/execute had no effect. -- ThiloPfennig
MoinMoin Version |
Release 1.5.0 |
OS and Version |
Gentoo Linux 3.3.4-r1 |
Python Version |
Python version 2.3.4 (#1, Nov 24 2004, 15:51:39) |
Server Setup |
farmconfig setup |
Server Details |
|
Workaround
You don't need this patch if you run Python >= 2.3.5 or >= 2.4.1.
Use this patch for moin 1.5.0 and older Pythons: moin15-384to386.diff
Apply it by:
cd MoinMoin/ patch -p2 <moin15-384to386.diff
The patched code will also be included in moin 1.5.1 when it is released.
I can confirm that this patch is working at one of my wikis! -- ThiloPfennig 2006-01-18 11:50:51
Discussion
The copy.py seems to differ between different python versions, see: Python CVS
I need more data on which python version works and which not: -- ThomasWaldmann
- Python 2.3.3 (solaris) works NOT
- Python 2.3.4 works NOT
- Python 2.3.5 works
- Python 2.4.0 works NOT
- Python 2.4.1 ? (I guess it should work, too)
- Python 2.4.2 works
This bug is not related to copy.py. Furthermore, reports suggest that it is not related to a specific python version. For me, it looks like a wikidicts race condition. I will try to work around it in the next release. -- AlexanderSchremmer 2006-01-16 09:10:42
I have also been "bitten" by this 'bug' when upgrading to 1.5 (from 1.183, no easy feat!). Both my Windows XP SP1/Python 2.3.4 and my Linux Mandrake 10.1/Python 2.3.4 exhibited the same Deep Copy error described here. The Python changelog for Python 2.3.5 RC1 mentions:
{{{copy.py fixed to first lookup copy from the instance being copied, rather than only looking at the type - this was broken in 2.3.}}}
I extracted the copy.py file from the 2.3.5 tarball and ran a diff between both versions (2.3.4 and 2.3.5). Interestingly enough, some of the function calls shown in the traceback have been changed between versions, so I updated the copy.py in my 2.3.4 installation to the one from 2.3.5 and that fixed the issue on both Windows and Linux. -- MarcCarignan 2024-11-24 10:04:04
That should be easy to find out if you have a nonworking system. If the bug happens all the time and after upgrading python it does not continue to happen, it is unlikely that it is a race condition. BTW: you seem to see race conditions everywhere. -- ThomasWaldmann
As I wrote the few lines of code that seem to make your wikidicts module go crazy (in some envs), I should know better here -- AlexanderSchremmer 2006-01-16 17:27:30
- Where is that code??
Moved from DesktopEdition/DeepcopyError
Trying to reach http://localhost:8080/ yields the following error on Linux (Slackware 10.1 Kernel 2.6.x) and Python 2.4. The wiki was launched from an unmodified extract of 1.5.0rc1 into an ordinary user home directory. It does not seem to be a permission problem because making all the directories and files world read/write/execute had no effect. Also, an installation of the non-desktop version of 1.5.0rc1 served by Apache (on port 80) runs without errors -- MikeEllis
Traceback (most recent call last): File "/home/xlrn/moin-desktop/MoinMoin/request.py", line 1041, in run self.page.send_page(self, count_hit=1) File "/home/xlrn/moin-desktop/MoinMoin/Page.py", line 1165, in send_page allow_doubleclick=1, trail=trail, File "/home/xlrn/moin-desktop/MoinMoin/wikiutil.py", line 1222, in send_title output.append("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> File "/home/xlrn/moin-desktop/MoinMoin/theme/__init__.py", line 840, in html_head html = [ File "/home/xlrn/moin-desktop/MoinMoin/theme/__init__.py", line 1107, in guiEditorScript if not (page.isWritable() and File "/home/xlrn/moin-desktop/MoinMoin/security.py", line 52, in <lambda> return lambda pagename, Page=Page, request=request, attr=attr: Page(request, pagename).getACL(request).may(request, self.name, attr) File "/home/xlrn/moin-desktop/MoinMoin/wikiacl.py", line 184, in may is_group_member = request.dicts.has_member File "/home/xlrn/moin-desktop/MoinMoin/request.py", line 170, in getDicts dicts.scandicts() File "/home/xlrn/moin-desktop/MoinMoin/wikidicts.py", line 392, in scandicts self.dictdict[name] = copy.deepcopy(grp) File "/usr/lib/python2.4/copy.py", line 161, in deepcopy y = copier(x, memo) File "/usr/lib/python2.4/copy.py", line 289, in _deepcopy_inst state = deepcopy(state, memo) File "/usr/lib/python2.4/copy.py", line 161, in deepcopy y = copier(x, memo) File "/usr/lib/python2.4/copy.py", line 252, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib/python2.4/copy.py", line 172, in deepcopy y = copier(memo) TypeError: cannot deepcopy this pattern object
Hmm, I cannot think of any reason why this should happen besides a quirk because of thread-unsafety (that code is known to break because of that). Can you try to start from scratch (re-extract it) and see if it happens again? If it still happens, edit /home/xlrn/moin-desktop/MoinMoin/wikidicts.py and put into line 392 the following string: "import pprint; pprint.pprint(grp)". Then safe the output into a file (by redirecting stdin for example) and attach it here.
- I re-extracted it. The error still occurs. Here's the output: It's small so I'll just paste it inline.
bash-3.00$ python moin.py Loading ... MoinMoin - 1.5.0rc1 [patch-354; DesktopEdition Release 1.5.0rc1-1] Serving on localhost:8080 <MoinMoin.wikidicts.Group instance at 0x407ca94c> <MoinMoin.wikidicts.Group instance at 0x407ca8ac> <MoinMoin.wikidicts.Group instance at 0x407ca62c> <MoinMoin.wikidicts.Group instance at 0x407ca8ec> localhost - - [04/Jan/2006 12:59:13] "GET /FrontPage?action=show HTTP/1.1" 200 -
I also found that putting a try/except TypeError around line 392 cures the problem, but that's obviously a hack. --MikeEllis
- OK, thats less verbose than I expected. Which Python version are you using?
Python 2.4 (#1, Jan 1 2005, 21:33:55) [GCC 3.3.4] on linux2
- As you seem to know at least a little bit of Python (figuring out how to catch the exception), can you try to figure out why there is that pattern object there? I still cannot reproduce it (tried on Linux machines as well ...)
(outdenting) The 4 group objects for which deepcopy is raising a TypeError are SystemPagesInEnglishGroup, MoinPagesEditorGroup, SystemPagesGroup and AutoAdminGroup. The only pattern object I see defined in the class Group is the regex. I tried moving that into the initFromText() method so as not to create an attribute in the class instance. Doing that had no effect, so it must not be the regex that's choking deepcopy(). Any further suggestions? Thanks --MikeEllis
I was able to reproduce the problem on a second linux box, also running Python 2.4. Upgrading to Python 2.4.2 cured the problem on both systems. --MikeEllis
- OK, so it was a bug in the python vm that weirdly confused those objects.
I've also ran into this but with Python 2.3.4 (and I don't have rights to upgrade Python either) and MoinMoin 1.5.0 (release). There was something funny about this though: I run two wikis on the same server, and on one of them all requests failed with this error, and the other wiki worked fine. I didn't have time to properly investigate this so I just did the same try/except hack as MikeEllis describes above. -- TomiJunnila 2006-01-08 21:19:04
I got that same problem on a brand new installation of MoinMoin 1.5 (release) on Solaris 10/Intel default install, which comes with Python 2.3.3. I use Standalone Mode. -- CĂ©dricBerger 2006-01-15 17:19:00
It does not need 2.4. I do use 2.3.5 and do not see such a problem with the latest DE-1.5.0-1. What is the cookery book to get it (step by step). -- ReimarBauer 2006-01-15 18:59:15
So now I got it too. One wiki on the same machine has it other's hasn't. Version 2.3.4 -- ReimarBauer 2006-01-16 17:51:53
Copying copy.py from the python 2.3.5 version tgz definitly solves this. Thanks for that tip! -- ReimarBauer 2006-01-16 18:15:49
I can confirm that the bug occurs with Python version 2.3.4, and can be fixed by upgrading to Python 2.4.2. -- PhilPishioneri
Plan
- Priority:
Assigned to: ThomasWaldmann
- Status: included own copy.py in moin--main--1.5--patch-385+386 (taken from python 2.4.2, with some minor changes for py 2.3.x compatibility)
Please reopen this bug if you can still reproduce it using latest 1.5 >= patch-386 (or the patch given in the Workaround section).