You are not logged in.
Pages: 1
Hello,
When try to use SynPDF + FastReport on ISAPI, it does not work.
Any suggerence ?
regards
Offline
Solved by undefine SYNZIP library {$undef USE_SYNZIP}
If not it raises an error on stream compress under ISAPI.
Offline
I have same issue..
The error generates in the TPdfStream.InternalWriteTo() when calling the CompressionStream function (Stack Overflow)
If compiled in normal Forms.TApplication instead of WebBroker.TWebApplication then USE_SYNZIP works just fine.
Anyone knows if it is possible to use SynZIP within an ISAPI? or the reason why it doesn't in ISAPI?
Offline
Hello,
When try to use SynPDF + FastReport on ISAPI, it does not work.
Any suggerence ?
regards
Hi CarlosM,
I have finally understood and solved the problem of SynPDF inside ISAPI using {$DEFINE USE_SYNZIP}
The problem is that the internal SynZip.CompressStream() function allocates 256Kb on the stack and inside an ISAPI this throws a StackOverflow exception, because your thread is not using your delphi defined stack size but the host worker default stack size, and (at least in IIS) it is probably 256Kb overall.
It is not an easy task to overwrite default stack size used by your threads but it is possible!
I have used a Detours Library to intercept the BeginThread and then inside the derouted function overwritten the stacksize.
Here it is my solution in my WebModule:
var
TrampolineBeginThread: function(SecurityAttributes: Pointer; StackSize: LongWord;
ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord; var ThreadId: TThreadID): THandle = nil;
function InterceptBeginThread(SecurityAttributes: Pointer; StackSize: LongWord;
ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord;
var ThreadId: TThreadID): THandle;
const
STACK_SIZE_PARAM_IS_A_RESERVATION = $00010000; // http://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx
begin
CreationFlags := CreationFlags or STACK_SIZE_PARAM_IS_A_RESERVATION;
StackSize := $100000; // 1Mb Stack size
result := TrampolineBeginThread(SecurityAttributes, StackSize, ThreadFunc, Parameter, CreationFlags, ThreadId);
end;
initialization
TrampolineBeginThread := InterceptCreate(@BeginThread, @InterceptBeginThread);
finalization
InterceptRemove(@TrampolineBeginThread);
I have used old version (v1) of Delphi Detours Library
I hope this helps
bye
Offline
Thank you!
Offline
Yes, there is a weird limitation of IIS threads.
See https://support.microsoft.com/en-us/help/932909
The stack size is limited to 256KB, so it was not possible to allocate more than that!
I've modified the source code to use 128KB for stream compression.
See https://synopse.info/fossil/info/f2fbefb9bf
Now SynZip should work directly over ISAPI.
Offline
Pages: 1