|
Rank: Newbie Groups: Member
Joined: 3/20/2014 Posts: 1
|
Running into Session cookies issues (see below for stacktrace) on concurrent requests. Scenario 1. Load up a webpage in the browser that has a button to generate itself into a PDF document 2. Now, we load up the same page 5 times in 5 different tabs in the same browser 3. We go through each tab and click the GEN PDF button We notice that the call to .ConvertURL() hangs and after a long time, we only get one PDF generated with the rest of the requests getting the stacktrace below.
Code: C#
Exception: EO.Pdf.Internal.k7: This session is no longer valid. If you wish to reuse the session later, please consider calling GetCookies to retain the session cookies, then reuse these cookies through HtmlToPdfOptions.Cookies with another session. (3)
at EO.Pdf.Internal.lu.l()
at EO.Pdf.Internal.lu.a(a A_0)
at EO.Pdf.Internal.lu.a(ck A_0)
at EO.Pdf.HtmlToPdfSession.Dispose()
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, Stream stream)
Wondering if EO.pdf can handle the scenario where a request is being made to generate the same PDF document simultaneously across multiple requests for the same session?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
The problem is not EO.Pdf. It's that ASP.NET does not allow you to have multiple requests running user code simultaneously for the same session. ASP.NET holds a session lock for you before it calls your code for a page (this is why you never have to worry about threading issues even though the server is multi-thread and it handles multiple requests at the same time). ASP.NET does that so that you never have to worry about concurrency issues in your code for the same session.
To avoid the problem, you can try to use ASPXToPDF. ASPXToPDF works slightly differently because it performs the conversion after your code has returned (thus session lock has already been released) thus bypassing the session lock.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/15/2014 Posts: 2
|
Hello!
I constantly encounter with the same exception, but the reason of the problem isn't ASP.NET session locking, because of i print page by page not simultaneously.
Moreover: - session is turned off (use attribute [SessionState(SessionStateBehavior.Disabled)]) - print isn't running in ASP.NET thread (use asynchronous controller)
My scenario: - printing of page with size ~50Kb is ok anytime (including after occuring 'Exception: EO.Pdf.Internal.k7') - page with size ~800Kb is printed only FIRST time after that i get 'Exception: EO.Pdf.Internal.k7'
Based on these i suspect your code ;(
Can you help me?
added: small clarification: i get next exception: EO.Pdf.Internal.k7: This session is no longer valid. If you wish to reuse the session later, please consider calling GetCookies to retain the session cookies, then reuse these cookies through HtmlToPdfOptions.Cookies with another session. (6) at EO.Pdf.Internal.lu.l() at EO.Pdf.Internal.lu.a(a A_0) at EO.Pdf.Internal.lu.a(cj A_0) at EO.Pdf.HtmlToPdfSession.Dispose() at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options)
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi Vladimir, That might be a time out error or an internal crash. Can you isolate the problem into a test project and send the test project to us? We will look into it here as soon as we have that. Please see how to submit test project here: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|