Jython

Message11511

Author jeff.allen
Recipients Ivan, jeff.allen, zyasoft
Date 2017年07月30日.09:35:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501407323.1.0.499852958804.issue2609@psf.upfronthosting.co.za>
In-reply-to
Content
Hmmm ... I'm not sure that actual concurrency (large numbers of parsers working at the same time) has much to do with this. I run my test as:
> while ../inst/bin/jython parse3a.py ; do echo "ok"; done
which lets me fiddle with the source as it runs. It can be quite a wait. The times I've caught this, the numbers were small. Here's one:
REPEATS=2, THREADS=10, LENGTH=2.
barfoo
foofoo
foobar
barfoo
foofoo
barfoo
barfoo
barfoo
barfoo
barfoo
barfoo
barfoo
foofoo
foobar
foobar
barfoofoofoo
barfoo
barfoo
 *** Caught one! ***
Traceback (most recent call last):
 File "parse3a.py", line 25, in parse
 if m.groups(): short_print(m.group(1))
AttributeError: 'org.python.modules.sre.MatchObject' object has no attribute 'groups'
> /home/jeff/Jython/iss2609/work/parse3a.py(25)parse()
-> if m.groups(): short_print(m.group(1))
(Pdb) p m
<org.python.modules.sre.MatchObject object at 0x2>
(Pdb) m.groups()
('foobar', '52536')
(Pdb) p tests
['barfoo84894', 'barfoo38345E', 'foofoo8017', 'barfoo42953', 'foobar52536E', 'foobar18661', 'barfoo35695E', 'foofoo89916', 'barfoo94921', 'barfoo32379']
(Pdb) p i
0
Now, as you can see, the object m behaved in the thread as if it had no groups() method, but later in the debugger it is present, and it yields the right result. This happens in the first block of threads.
My theory is that use of this object by the thread is running ahead of initialising the object or (quite likely) its class dictionary. I'll test that, see if I can get an incriminating snapshot.
History
Date User Action Args
2017年07月30日 09:35:23jeff.allensetmessageid: <1501407323.1.0.499852958804.issue2609@psf.upfronthosting.co.za>
2017年07月30日 09:35:23jeff.allensetrecipients: + jeff.allen, zyasoft, Ivan
2017年07月30日 09:35:23jeff.allenlinkissue2609 messages
2017年07月30日 09:35:22jeff.allencreate

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /