[jsword-devel] Forking conversation to discuss bug in ZVerseBackend (and potentially other backends?)

Chris Burrell chris at burrell.me.uk
Sun Nov 7 05:40:10 MST 2010


I believe the problem is because ZVerseBackend is not thread-safe. Being a
singleton, it starts sharing all its arrays declared as member variables. As
a result, when two passages from the same "Book" (for e.g. KJV) are used,
there is corruption, since the data read for Thread A might also be shared
by Thread B!

A few solutions I can think of:
- do they need to be singletons? I guess it makes sense, but what is the
cost involved in them being singletons? Don't know the code base well enough
yet.
- do the member variables need to member variables, or can be make them
local variables? Do they share state across methods?
- If the option above doesn't work, then synchronising the method might be
worth looking at, however, in a web environment, that would potentially
cause serious bottlenecks, especially if there is a default version (and
default passage) that is displayed when the user brings the page up.

Any thoughts?
Chris



On 7 November 2010 00:04, Chris Burrell <chris at burrell.me.uk> wrote:

> On this last note, I believe we have concurrency issues. I have a two
> column page, displaying one passage each. On load of the page they load up a
> passage each, but then this once, the passage on the right (only verse 1)
> has gone to the left (which was requesting just one verse but from a
> different passage:
>
> left pane: requested Acts 2:10, got Romans 1:1
> right pane: corrupt XML in verse 1, verse 2 seems to be Romans
> 1:2-following
>
> Anyone else come across those issues?
> Chris
>
> On 6 November 2010 20:53, Chris Burrell <chris at burrell.me.uk> wrote:
>
>> Another question too. It seems sometimes, both in bible desktop and my
>> current application, the html rendered is broken?
>>
>> Any ideas why that might be?
>>
>> For example, I get:
>> "<div class="passageText ui-widget"><div><h2 class="heading">Acts
>> 2:10</h2><span class="verse"><span class="w"><sup
>> class="verseNumber">10</sup></span><span class="w"*><span
>> class="text">emma="strong:G1909" morph="robinson:PREP*" src="4"&gt;upon
>> every soul of man that doeth evil, of the Jew first, and also of the
>> Gentile;</span></span></span> </div></div>"
>>
>> The above in bold shows that it didn't get XSLTed properly.
>>
>> Instead of "<div class="passageText ui-widget"><div><h2
>> class="heading">Acts 2:10</h2><span class="verse"><sup
>> class="verseNumber">10</sup><span class="w"><span class="text">&nbsp;</span>
>> </span><span class="w"><span class="text">&nbsp;</span> </span><span
>> class="w"><span class="text">Phrygia</span></span>, <span class="w"><span
>> class="text">&nbsp;</span> </span><span class="w"><span
>> class="text">and</span></span> <span class="w"><span
>> class="text">Pamphylia</span></span>, <span class="w"><span class="text">in
>> Egypt</span></span>, <span class="w"><span class="text">and</span></span>
>> <span class="w"><span class="text">in the parts</span></span> <span
>> class="w"><span class="text">of Libya</span></span> <span class="w"><span
>> class="text">about</span></span> <span class="w"><span
>> class="text">Cyrene</span></span>, <span class="w"><span
>> class="text">and</span></span> <span class="w"><span
>> class="text">strangers</span></span> <span class="w"><span class="text">of
>> Rome</span></span>, <span class="w"><span class="text">Jews</span></span>
>> <span class="w"><span class="text">&nbsp;</span> </span><span
>> class="w"><span class="text">and</span></span> <span class="w"><span
>> class="text">proselytes</span></span>,</span> </div></div>"
>>
>> So somehow it lost a whole load on the way out of the XSLT? The only
>> difference is that the first one is on startup of the server, the second is
>> with a refresh in the browser. Perhaps something hasn't loaded up
>> correctly/entirely?
>>
>> Chris
>>
>> On 5 November 2010 23:10, Chris Burrell <chris at burrell.me.uk> wrote:
>>
>>> Thanks DM. So I found this page (again)!
>>> http://www.crosswire.org/~dmsmith/interlinear/
>>>
>>> <http://www.crosswire.org/~dmsmith/interlinear/>And managed to replicate
>>> (and solve?) the issues I found originally when I looked at it before:
>>>
>>> 1st When lines in the interlinear only have 1 line (i.e. no 2nd/3rd or
>>> 4th line). As a result, when the text wraps, it floats below the first line.
>>> As a hack (although on could argue that there is an empty spot there, rather
>>> than nothing), I think we can put a <span>&nbsp;</span> or we could use a
>>> height maybe? (not quite so good, unless we specify in ems and exs). And the
>>> second thing is that within a particular word stack, the words might wrap. I
>>> believe this particular issue is only visible in IE. For IE 8, the fix is to
>>> put a whitespace: nowrap CSS directive. Not sure if that helps on IE6 and 7
>>> though? Spec says it should be supported on both browsers.
>>>
>>> And yup, I'm targetting web environments, and also web mobile browsers.
>>> Chris
>>>
>>>
>>> On 5 November 2010 20:09, DM Smith <dmsmith at crosswire.org> wrote:
>>>
>>>>  I'm heading out for the weekend. In a few minutes.
>>>> It'll probably be Monday evening when I send it.
>>>>
>>>> The solution uses spans with their display set to block.
>>>>
>>>> -- DM
>>>>
>>>>
>>>> On 11/05/2010 03:55 PM, Chris Burrell wrote:
>>>>
>>>> DM, you said you might have an intearlinear model that worked? I had
>>>> another look to see how I did mine previously, and found that in fact I used
>>>> tables. I think I struggled for quite a while to get a model working across
>>>> browsers using DIVs, but none of them seemed to wrap properly at the end of
>>>> the line.  But unfortunately table layouts are slow and therefore it would
>>>> be better to have divs.
>>>>
>>>>  Would you be able to let me have your samples?
>>>> Chris
>>>>
>>>> On 5 November 2010 19:21, Chris Burrell <chris at burrell.me.uk> wrote:
>>>>
>>>>> What's GNT? Greek New Testament? I think we can do more than that too.
>>>>> If other Bible versions have strong numbers and/or morphology tags, then we
>>>>> can put those in parallel, and end up having French with English
>>>>> "subtitles", or English with English, as well as English with Greek, etc.
>>>>>
>>>>>  So I've had a look at the framework so far and it seems fairly easy
>>>>> not to use Bible Desktop components and have a good XSLT transformation. So
>>>>> all we would need to add is some helpers that users can easily integrate
>>>>> into their XSLTs. It would nice to have some sample XSLs for people to use.
>>>>> So for example, I've had to strip out all the CSS and font tags from the
>>>>> Bible Desktop one so as to produce a good XHTML compliant one.
>>>>>
>>>>>  Say we give the XSLT a InterlinearProvider initialised with its
>>>>> version and passage, as it parses the strong/morph option we can then call
>>>>> get($provider, @strong, @morph), which would in turn optionally return the
>>>>> correct words (or best word since sometimes you may have multiple options in
>>>>> modules tagged with strong numbers only. In fact it would be better to have
>>>>> something like get($provider, osis_verse_id, @strong, @morph). Since then,
>>>>> if we don't have the morphology of the word, at least we can limit the
>>>>> lookups to those words that are tagged in a particular verse (that assumes
>>>>> that versification is comparable between versions).
>>>>>
>>>>>  We'll want to add options to have tagged information displayed on the
>>>>> side of a word/phrase or below a word/phrase. At the moment the XSLT
>>>>> displays morph and strong tags next to the text. I'll add some
>>>>> transformations to have it on separate lines. Then we can reuse the same
>>>>> transformations to line up text beneath it.
>>>>>
>>>>>  DM, I had a look at "flying saucer" , but didn't quite understand
>>>>> where it comes in? Would the idea be instead of the XSLT? And have it
>>>>> transform to different UIs?
>>>>>
>>>>>  Chris
>>>>>
>>>>>
>>>>> On 5 November 2010 03:51, Tonny Kohar <tonny.kohar at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, Nov 4, 2010 at 11:30 PM, DM Smith <dmsmith at crosswire.org>
>>>>>> wrote:
>>>>>> > Much of the transformations is done in BibleDesktop. Refactoring
>>>>>> these and
>>>>>> > putting it into JSword and/or common would be good.
>>>>>> >
>>>>>>
>>>>>>  +1
>>>>>> Yes it would be nice to have this under JSword instead of BIbleDesktop
>>>>>>
>>>>>> Sincerely
>>>>>> Tonny Kohar
>>>>>> --
>>>>>> Alkitab Bible Study
>>>>>> http://www.kiyut.com/products/alkitab/index.html
>>>>>>
>>>>>> _______________________________________________
>>>>>> jsword-devel mailing list
>>>>>> jsword-devel at crosswire.org
>>>>>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> jsword-devel mailing listjsword-devel at crosswire.orghttp://www.crosswire.org/mailman/listinfo/jsword-devel
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> jsword-devel mailing list
>>>> jsword-devel at crosswire.org
>>>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20101107/bb883633/attachment.html>


More information about the jsword-devel mailing list