Re: [xslt] Replacing the dict used by the transform context




Daniel Veillard wrote:
> On Mon, Aug 07, 2006 at 02:46:14PM +0200, Stefan Behnel wrote:
>>> those are libxslt general rules. You may break them without trouble or not
>>> depending on the context of use. But they are strict guidelines when it come
>>> to libxslt own code:
>>>  - transformation dictionnary must be derived from the stylesheet dict
>>>  - stylesheet dict must be read only at transform time
>>>  - the generated document should probably reuse the transformation dict
>>>
>>> I think in general libxslt tries to cope when this is not the case, but
>>> it's very hard to garantee non-pathological behaviour if those expectations
>>> are not met, for example it's nearly garanteed that processing will be slower,
>>> potentially quite slower !
>> "does not crash" is definitely more important than speed here.
>>
>> What is that "should probably" doing in the third rule? I mean, that happens
>> to be the source of the whole problem. So I'm wondering, if that's only a
>> "should probably", would it be hard to separate the two?
> 
>   Sorry I would have to go though the whole code to make sure of the impact
> no way I can do that from memory.

Sure, sorry. I was just wondering why you said something as vague as "should
probably" for the thing that troubles me, while at the same time being sure
about the other two rules, which are not a problem at all.


>>>   I don't know when and how you took that decision, I cannot garantee you
>>> will have a perfectly working solution in the general case that way.
>> Well, it wouldn't work if we used the same dict for all threads, as dictionary
>> access is not serialised in libxml2.
> 
>   One more reason to use a subdict.

Sure, but storing a dictionary reference in each node to prevent the dict from
being freed by accident is not very efficient.


>> So, what is the right thing to do? We already tell users not to share
>> documents between threads (or at least not to modify them if they do). So the
>> only remaining problem seems to be XSLT. From your rules above, I think we
>> will end up disabling running stylesheets in other threads than the one they
>> were parsed in, so no more xsltStylesheet sharing between threads. That's the
>> only solution I see to comply with your first rule. The second rule is worked
>> around by making the stylesheet dict also the transform dict, and so is the
>> third rule.
> 
>   Direct immediate example of the problem if you break #1:
[example why breaking rule 1 will not work]

Sure, I'm not questioning the first rule. I was serious. Would you consider
the above a viable solution or could you come up with a way to safe the
concurrency support in XSLT processing?

Stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]