[Xitami] Possible race condition in Xitami's temporary files module
Dmitry Isakbayev
xitami@lists.xitami.org
Thu, 23 May 2002 18:26:34 -0400
Hi Even,
I have followed your recommendation and everything works as expected for as
long as the size of BIG_RESPONSE stays under (2^16). However, when that
threshold is exceeded something breaks. In my use case, LRWP sometimes
generates 65,838 bytes of data. When this happens, Xitami sends only few
packets of that response back to the client. Is it possible that 65,838
byte value somewhere overflows a 16-bit buffer? Could you point me to the
right direction?
Regards,
Dmitry
> -----Original Message-----
> From: ewen@naos.co.nz [mailto:ewen@naos.co.nz]On Behalf Of Ewen McNeill
> Sent: Sunday, April 07, 2002 4:08 AM
> To: xitami@lists.xitami.org
> Cc: Dmitry Isakbayev
> Subject: Re: [Xitami] Possible race condition in Xitami's temporary
> files module
>
>
> In message <NEBBIJGPHKNLMOCJIHFJIEIDDAAA.dmitry@transnexus.com>,
> "Dmitry Isakbayev" writes:
> >If there might be a bug in the way Xitami handles temporary
> files, how can
> >we avoid using them?
>
> If you can recompile Xitami for your platform, and are willing to spare
> some memory, then you can change the constant that triggers when a LRWP
> response will be spooled to disk. The relevant compile time constant is
> BIG_RESPONSE_LEN in xilrwp.c; the default setting is 16384, ie 16KB. If
> you make this, say, 1048576, then up to 1MB will be held in memory. (If
> you're server is busy and sending a lot of large responses, then
> obviously you'll need to have a lot of memory available.)
>
> >How can I learn more about the way Xitami uses temporary files
> and generates
> >temporary file names?
>
> Unfortunately the only real documentation for this internal stuff is the
> source code. Most of it is smthttpl.c IIRC, although the main control
> logic is in smthttp.c, and the thread of execution pops in and out
> between the two of them.
>
> For LRWPs the main thing to remember is that once the response is
> received from the LRWP program it's basically treated like a CGI
> response. (The same is true for filter responses BTW.)
>
> The temporary files are created in smthttpl.c in the CGI case, and
> xilrwp.c in the LRWP case.
>
> Ewen
>
> --
> Ewen McNeill, Technical Consultant, iMatix Corporation www.imatix.com