Re: [xslt] Shared memory xsltNewTransformContext problem



On Tue, Nov 30, 2004 at 08:20:45AM -0000, spinmar interfree it wrote:
> I have a program which creates a name-based shared memory (with apr): my program insert into this shm an array of struct. Each struct is composed by an id and a xsltStylesheetPtr.
> Each client (apache client) calls a function which attach to shm, get xsltStylesheetPtr by an id and then it should execute the trasformation. 
> The step which is giving me a segmentation fault is 
> ctxt = xsltNewTransformContext(cur, input);
> where cur has been extracted by the shared memory.
> I don't know where is the error: I have tried to print my struct and I obtain the id and the addresses of my xsltStylesheetPtr.
> Do you see any possible error? How can I debug my application? 

  Playing with shared memory obviously makes debuging memory allocations
way harder. And without at least a stack trace to see where the segmentation
fault occurs there is no way I may even start to hint about where the 
problem lies.

> Is xsltNewTransformContext usable in this scenario?

  I think so, I don't see why not.

> Maybe my error is when I aloc the size of shm with this instrauction:
> #define SHARED_SIZE (apr_size_t) ((MAX_ENTRY_XSL * sizeof(xslstructptr)) + (MAX_ENTRY_XSL * sizeof(xsltStylesheetPtr)))
> Do you have any idea?

  I have no idea what your xslstructptr is but the xsltStylesheetPtr part is
patetntly wrong. If you share only the size of the pointer to the stylesheet
you obviously do not share the stylesheet content too. You can't just pass
a pointer to a memory reference in the VM of another process and expect 
that to work. You will have to share all the object adressable from that 
pointer too, and that mean you would have to change libxslt compilation 
to force all allocations in that shared memory segment when you compile 
the stylesheet. Doable, but you're on your own for debugging this, you're
warned it may not be simple at all to set-up and debug.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


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